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.

</end>

Technorati Tags:

Subscribe to my blog.

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

  1. No name

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

    Reply
  2. No name

    http://www.hzygzs.com/contact 杭州装饰公司
    http://www.hzygzs.com/about 杭州装饰公司
    http://www.hzygzs.com/news 杭州装饰公司
    http://www.hzygzs.com/ 杭州办公室装修
    http://www.youither.com/pro/pro-cn.asp
    http://www.youither.com/pro/pro-bee3-cn.asp
    http://www.youither.com/pro/bee2.asp
    http://www.youither.com
    http://www.youither.com/pro/aloe.asp
    http://www.hzygzs.com/case 杭州装修公司
    http://www.hzygzs.com/messages 杭州装修公司
    http://www.yixinvalve.com.cn
    http://www.hzygzs.com/ 杭州店面装修
    http://www.yixinvalve.com.cn ball valve球阀
    http://www.linlidq.com ATS
    http://www.whdq.net 气动
    http://www.htbzj.net 标准件
    http://www.led-lt.com LED,苏州LED,上海LED,北京LED
    http://www.smilestudio.cn 网站建设,网站推广
    http://www.xinjusy.com 苏州装修公司,苏州装饰公司
    http://www.atsesj.com ATS
    http://www.x-qun.com 芯片
    http://www.youither.com/pro/bee2.asp 蜂王浆
    http://www.youither.com/pro/aloe.asp 芦荟
    http://www.youither.com/pro/pro-bee3-cn.asp 蜂胶
    http://www.yixinvalve.com.cn/Products/View/1053valve.html ball valve球阀
    http://www.yixinvalve.com.cn gate valve闸阀
    http://www.yixinvalve.com.cn angle valve角阀
    http://www.yixinvalve.com.cn/Products/View/3004valve.html bibcock水嘴
    http://www.yixinvalve.com.cn tap
    http://www.yixinvalve.com.cn/Products/View/4003valve.html Check valve
    http://www.yixinvalve.com.cn/Products/View/5075valve.html hot-water heating
    http://www.yixinvalve.com.cn/Products/View/5071valve.html fittings

    Reply
  3. No name

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

     

    Reply
  4. (no name) wrote:
    Paul,
     
    Please responsd to this. Does your solution work if the the list item is edited more then one time?
    Reply
  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.
    Reply
  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.
    Reply

Leave a Reply to No name Cancel reply

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