By default SPD 2010 does not allow possible infinite loops to be added to a workflow. Here is the guide how you can do it:
- Open SPD 2010
- Add a new Workflow
- Add new IfElseActivity and fill in the conditions and the actions you want to loop through
- Save the workflow
- Go to Alle Files -> Workflows -> Your workflow name folder and open “your workflow name.xoml” file as xml.
- Locate the lines that look like this:
<IfElseActivity x:Name="ID411"> <IfElseBranchActivity x:Name="ID412"> <IfElseBranchActivity.Condition> <RuleConditionReference ConditionName="__Rule_ID412" /> </IfElseBranchActivity.Condition>
And replace if with something like this:
<WhileActivity x:Name="ID411"> <WhileActivity.Condition> <RuleConditionReference ConditionName="__Rule_ID412" /> </WhileActivity.Condition>
Keep in mind that you have to remove also the ending tag of the IfElseBranchActivity. Keep also in mind that if you have multiple activities in the IfElseActivity taht you have to encapsulate these activities into one single SequenceActivity.
Now you can Publish your workflow back to SharePoint.
One drawback of this approach is that SPD does not support designing of a whileactivity in the worklow designer so you have to change the activities direct in the xoml file or you can replace the whileactivity again with ifelseactivity, do your changes and replace it again.
You have to also modify the web.config of the web app where you want to deploy your workflow because by default is the WhileActivity disabled. Locate following line
<authorizedType Assembly="System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Workflow.*" TypeName="WhileActivity" Authorized="False" />
and set the “Authorized” attribute to True.