Posted by: R Manimaran | December 2, 2010

SharePoint workflow Replicator – Parallel Approval Problem Solution

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));

[Browsable(true)]

[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]

public Object ChildData

{

get

{

return ((object)(base.GetValue(CustomReplicatorChild1.ChildDataProperty)));

}

set

{

base.SetValue(CustomReplicatorChild1.ChildDataProperty, value);

}

}

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.

Advertisements

Responses

  1. This definitely helped, i was stuck with this for a few weeks trying several different methods – the thing that finally got things working (although others have got it working in different ways) was using (CustomReplicatorChild1)e.Activity in the childInitiialized method to get the current data.

    Many thanks!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: