2

I want to do the same thing over and over again with a workflow. So i don't want to use many if condition. Can i use switch case or for /while loop?

  • Which version are using SharePoint 2010/2013? And which workflow are you using like OOTB workflow or Designer workflow. – san Sep 25 '17 at 6:32
  • I am using 2013 Sharepoint Designer workflow.. What is OOTB? You say Online? – f_gulay Sep 25 '17 at 6:44
  • Out-Of-The-Box. – san Sep 25 '17 at 6:45
  • For SharePoint Designer workflow you can use below link. – san Sep 25 '17 at 6:46
  • Sorry I have to say mine is Sharepoint Designer 2010 Workflows... I checked it now.. – f_gulay Sep 25 '17 at 6:46
1

No, you cannot use loops and switch case conditions in SP 2010 workflow...but you can use it in SP 2013 designer workflow.

  • does this answers your question? – Ganesh Sanap Nov 15 '18 at 13:19
0

SharePoint 2010 does not have a looping function for workflows. You will have to sorta "trick" the workflow engine to re-check the item over and over again.

One way you can do this is to use two separate lists with trigger fields that toggle back and forth while the workflow jumps between the two lists. You then have logic within the Main List workflow that sets a "Stop" trigger.

  1. Create a main list that you want to have the items looped upon
  2. Create a toggle field in the Main List that will a "1" or "0" field to start/stop the 'loop'. Default value of "1"
  3. Create a loop count in the Main List that will just count
  4. Create a Main Workflow within the Main List that has logic to run on "Item Modified" and "Item Created"
  5. Set rule within workflow to take action if Toggle Field = '1'
  6. Set rule within workflow to stop action if Toggle Field = '0'
  7. Create a new Toggle List; this will trigger the Main List item
  8. Create action within Main workflow to create new item within Toggle List. Save Main Item ID within Toggle List
  9. Create a Toggle Workflow within the Toggle List to run on "Item Created"
  10. Pause for 3-5 seconds or so with Toggle Workflow
  11. Update original Main List item (with the ID you saved) by incrementing the loop count field
  12. The loop will continue based on the logic you have in steps 5 and 6

Here is one example of an approval workflow with a looping function: https://social.technet.microsoft.com/wiki/contents/articles/24589.sharepoint-2010-build-a-loop-workflow.aspx

Another example with a longer pause: https://sharepointduffbert.com/2015/03/10/creating-a-repeating-looping-workflow-in-sharepoint-2010/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.