2012 Illinois Technology Association - CityLights Finalist

BLOGS

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

Contact Us
HOT JOBS
Interested in reviewing our current job openings or submitting a resume?
CLICK HERE
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.

 

SPTaskActivity.png

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.

SPTaskActivityToolbox.png

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.

 WorkflowWithSPTaskActivity.png

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.

ReplicatorActivity_Init.png

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

ReplicatorActivityChildInit.png

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
Part Of SPR COMPANIES
© 2014 SPR Companies. All rights reserved. About | Competencies | Products | Solutions | Clients | Events & Resources | Careers | Site Map | Legal/Privacy