Monday, March 3, 2014

Looping through all List Items in a SharePoint List using a SharePoint Designer 2013 Workflow

If you need to loop through all List Items in a SharePoint List in a SharePoint Designer 2013 Workflow, you can accomplish this by following the guidance in this article: http://www.proactivespeaks.com/2013/08/08/looping-on-list-items-in-sharepoint-designer-workflow-2013/

However, I made a few crucial changes to the logic provided in the above article:


  1. Rather than populating the items into a Dictionary in order to get a specific column from the JSON Result Set, I simply queried for it directly like so: d/results([%index%])/Title
  2. When using the conditional counter with an integer variable such as index, the initial value is 0.  However, unless some additional logic is in place, the value will never be incremented!!  Therefore, some additional logic is necessary to make sure that the final value is incremented in order for the loop to completely execute such as:
    then Calculate Variable:index plus 1 (Output to Variable: calc) 
    then Set Variable:index to Variable: calc

This is the final view of the Looping Workflow that I had in place:


This article also discusses how to perform Looping of List Items in a SharePoint Designer Workflow: http://weblogs.asp.net/ricardoperes/looping-through-list-items-in-sharepoint-2013

No comments:

Post a Comment