Use Semaphores in SharePoint Designer Workflow to Prevent Endless Loops

It’s possible to cause an endless loop in a SharePoint Designer workflow.  A common implementation pattern like this causes the problem:

  • Create a workflow and associate with a list.
  • Indicate that it should start on create of new items and update of existing items.
  • A step in the workflow updates a field in "Current Item".
  • Since the current item changed, the workflow starts anew.

To prevent this endless loop, implement a simple semaphore:

  • Add a site column (or column to the list/library if you’re not using content types).
  • Hide it from the edit page (easy to do if a site column via its properties, not as easy if a list column).
  • In the workflow, check to see if the value of the semaphore column is blank.
  • If it is blank, set it to a non-blank value and proceed.
  • If is is not blank, exit immediately.

This can become a fairly nuanced solution, depending on business requirements and so forth, but it’s been a workable pattern when I’ve needed it.


Technorati Tags:

Subscribe to my blog.

6 thoughts on “Use Semaphores in SharePoint Designer Workflow to Prevent Endless Loops

  1. No name New BATTERY For TOSHIBA 5000 5100 PA3123U PA3178U laptop battery, Battery For Toshiba Portege M200 M205 PA3128U PA3191U black laptop battery, Battery for Toshiba Satellite 1100 1110 PA3209U-1BRS laptop battery, Battery for Toshiba PA3399U-1BRS PA3399U-2BAS 1BAS laptop battery, Toshiba PA3356U-3BAS PA3356U-3BRS PA3456U-1BRS Battery laptop battery, toshiba pa3420u-1brs l10 l15 l20 laptop battery, TOSHIBA PA3451U-1BRS PABAS067 laptop battery, Battery For PA3383 TOSHIBA Satellite PA3383U-1BRS 12cells laptop battery, TOSHIBA SATELLITE M65 BATTERY PA3431U-BRS PABAS068 laptop battery, clevo m540 laptop battery, uniwill 255-3S4400-G1L1 un255 laptop battery, uniwill Amilo A-1630 A1630 UN258 laptop battery, uniwill 755-4S4000-S1P1 un755 laptop battery, uniwill un233 laptop battery, apple A1175 Macbook Pro 15-4 laptop battery, Battery For ASUS M3 M3N M3NP M3000 M3000N M3000NP 4S2P black laptop battery, asus a42-m6 m6n m67 m68n m6000 laptop battery, asus W1 W1000 A42-W1 W1G W1Ga laptop battery, ASUS A31-S5 A32-S5 S52N S5000 S5200N S5N laptop battery, MITAC 8375 8575 8575A 8575P LAPTOP BATTERY grey laptop battery, Battery For Toshiba Portege M200 M205 PA3128U PA3191U black laptop battery, acer aspire batcl32l 2000 batcl32 2001 2003 laptop battery, acer travelmate 370 380 btp-73e1 btp-50t3 laptop battery, acer LC.BTP05.004 Aspire 1670 series laptop battery, AS07A41 Aspire 4310 4520 4710 4920 laptop battery, Aspire 3100 3690 5100 5110 9110 9800 laptop battery, acer travelmate 290 291 29x 292 batcl50l laptop battery, acer travelmate 350 352 353 354 btp-36d1 laptop battery, acer btp-620 btp-39d1 btp-39sn ms2103 laptop battery, acer travelmate 22x 23x 26x 28x btp-43d1 laptop battery, acer BT.A1007.002 SQU-302 laptop battery, asus a4 a4d a4g a4k a4l a4s a4000 a42-a4 laptop battery, A32-F3 Battery ASUS F3 F3J F3Q F3JA F3JM F3JF Hi-Capaci laptop battery, battery for COMPAQ M300 N400 146630-001 291694-001 laptop battery, Battery fits COMPAQ Presario 1200 1600 1800 116314-001 laptop battery, Battery For Compaq Presario 311227-001 PP2162S Laptop laptop battery, battery for COMPAQ N150 PP2111X 232060-001 231962-001 laptop battery, Notebook Laptop Battery for Dell D9200 D5318 G5260 laptop battery, 6600mAh Battery fits DELL XPS M1210 NF343 HF674 NEW laptop battery, 3cell Battery for Dell Latitude X1 T6840 312-0342 Y6457 laptop battery, New Dell Inspiron B130 1300 b120 Battery 312-0416 56whr laptop battery, Gateway M360 M460 M680 8-Cell Notebook Battery 6500949 laptop battery, New Battery for HP M2000 Series DV1000 DV4000 laptop battery, Battery For HP F2019 F2019A F2019B 6000 VT6200 XT6200 laptop battery, Battery For HP HSTNN-IB04 346970-001 HSTNN-DB02 DP399A laptop battery, New F1739A Battery For HP XE XE2 Pavilion N3000 N3490 laptop battery, New Battery For HP Pavilion ZT1000 F2299A F3172B F3172A laptop battery, Battery for Gateway Solo M500 M505 Medion MD2900 MD6179 laptop battery, Battery Fit Toshiba PA3382U-1BRS PA3384U-1BRS laptop battery,

  2. No name 杭州装饰公司 杭州装饰公司 杭州装饰公司 杭州办公室装修 杭州装修公司 杭州装修公司 杭州店面装修 ball valve球阀 ATS 气动 标准件 LED,苏州LED,上海LED,北京LED 网站建设,网站推广 苏州装修公司,苏州装饰公司 ATS 芯片 蜂王浆 芦荟 蜂胶 ball valve球阀 gate valve闸阀 angle valve角阀 bibcock水嘴 tap Check valve hot-water heating fittings

  3. No name

    ショッピング枠現金化するので誰でもかんたんにカードでお金をおつくりできます♪ご融資などではありませんので審査や面倒な手続きは一切ございません! ご返済方法は一括・リボ・分割(最高20回)・ボーナス一括などからお選びいただけます。 


  4. (no name) wrote:
    Please responsd to this. Does your solution work if the the list item is edited more then one time?
  5. No name
    Maybe I’m missing something here, but that seems to work the first time, but never again.
    When you set the field to Non blank, it will exit the secone time its called. That’s good.
    But when you update the item, say 15 min later, then the field is still set to non blank, thus, it exits without running the workflow… am I missing something.
    I hope I am, as I need to work.
    As an FYI, I have a less elegant solution.
    Rather than setting a flag on the item itself, I create an entry in a new list. Then the second time through, I delete it. That acts as the flag, but I would like a more elegant solution if possible.
  6. ThiNg wrote:
    To take this suggestion one step further –
    I created a separate custom list called Notifications and created a column for each workflow I have. I was having trouble when sending emails – causing a loop – and mail bombing my inbox.  So now, I have the workflow check the status of the column (of the same name) BEFORE the email is sent, and then change the value AFTER the email is sent.

Leave a Reply to (no name) wrote: Cancel reply

Your email address will not be published. Required fields are marked *