2012 Illinois Technology Association - CityLights Finalist


MPS Partners provides functional and technical expertise and insights into business process management trends and Microsoft technologies.

Contact Us
Interested in reviewing our current job openings or submitting a resume?
Home » Blog » SharePoint » SharePoint 2010 Approval Workflow – Dynamic Approvers

SharePoint 2010 Approval Workflow – Dynamic Approvers

​While working on MPS Facts series I was faced with a task of creating a custom workflow in Visual Studio 2010 that involved pulling dynamic approvers from a SharePoint list. As usual I searched around for answers but most mostly found material that dealt with fixed number of approvers. After I was done chasing the wrong rabbit, I finally gathered enough information to come up with a two-part solution to the problem.

Below are the high level steps to the solution. If you are interested in details, feel free to contact me.

1. First I created a custom activity that I named SPTaskActivity that contained CreateTask, OnTaskChanged and CompleteTask activities, the components that are normally required for creating and tracking tasks. I set up task tokens and other properties as I would normally in any workflow so nothing out of norm there.



2. Then I complied and built the project. Next I added a new sequential workflow to the project. When I opened up the toolbox I could see that my SPTaskActivity was listed there as shown in the picture below.


3. I then added a Replicator Activity and dragged and dropped the SPTaskActivity into it. The Replicator Activity works like a for-each loop. It takes any list that inherits from IList interface as one of the parameters and performs actions for the activities that are contained with it (in this case SPTaskActicity) for each list item. After I was done setting up all activities, my final workflow looked like as shown below.


4. In the Replicator Activity initialized routine I queried the ‘New Vendor Approvers’ list and passed the first approver to the SPTaskActivity activity to kick off the workflow.


5. In the Replicator Activity child initialize routine, I sent the next approver to the SPTaskActivity.


6. The Replicator Activity in my solutions was set to send task sequentially but it can also be configured for paralell processing. I found Replicator Activity to be very useful and easy to use once I got over the initial hump. The Replicator Activity has other interesting properties and events so check it out and see if you can utilize it in your next solution. Happy coding!


This entry was posted in SharePoint. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *

View By Author
  • View By Category
View By Date
© 2014 SPR Companies. All rights reserved. About | Capabilities | Products | Solutions | Clients | Events & Resources | Careers | Site Map | Legal/Privacy