SharePoint workflow Replicator – Parallel Approval Problem Solution
I have created a Workflow using Visual Studio. My requirement is the user should has the following option
· Allow multiple users in approving an Item
· Approvers Task needs to be created Serial
· Approvers Task needs to be created Parallel
· When the required number of tasks gets completed the Item needs to get approved.
I have used to Replicator control to create the multiple tasks. For the Sequential creation/execution of the tasks the Workflow is working correctly. If we change the Replicator property execution Sequence to parallel, the tasks are created correctly. But on Approving all the task my workflow is showed In Progress status.
After a week searching in the Internet, I found a Solution.
In the workflow under Replicator Activity, I have placed the Set of Sequence Activities.
This activity needs to be moved to a Custom Sequence activity.
1. Create a new Class File and Inherit System.Workflow.Activities.SequenceActivity
2. Now Place all the activities in the custom Sequence activity.
3. Create a Custom Property
public static DependencyProperty ChildDataProperty = DependencyProperty.Register("ChildData", typeof(Object), typeof(CustomReplicatorChild1));
public Object ChildData
4. After completing the above coding build the application. Now a new Custom Activity will be available in your toolbox.
5. Drag and drop the activity inside the replicator activity.
6. Now the workflow will be like this.
7. Here customReplicatorChild is my custom Sequence activity.
8. In the Replicator ChildInitialized Handler, add the following code.
((CustomReplicatorChild1)e.Activity).ChildData = e.InstanceData;
9. Apart from that create a new Property for WorkflowProperties in Custom Sequence Activity.
10. While doing this makes sure all the activities has correct correlation token and Owner activity.