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