Wednesday, July 22, 2015

Looping in SharePoint Designer 2013 Workflow

1. When you just need to loop through list items/item fields, then prefer the below steps.


2. When you need to loop through list items / item fields and also testing a condition, then prefer the below link.

Hi Folks,

I worked on a requirement to read all the list items from a list and compare its fields "Blackout Date" and "Team" value for each item with the current item fields "StartDate" and "Team" in current list.
I used looping in SPD 2013 to implement this function. 

Developers would know how to compare using conditions. I'll just focus on looping part.

1. We need to use HttpServices action to read list items.



For the first step, we did the below steps to build the dictionary




For the second step, follow the below steps.



The URL is : https://accobrands.sharepoint.com/sites/ITAppDev/CCISDev/_vti_bin/client.svc/web/lists/getbyid('E704B0F5-58DE-4627-9769-6415E0677AEB')/Items



The rest steps are pretty straight. Follow them.



Now comes the looping part. We need to initiate the loop with workflow variable say "index". Check the below steps.

The below steps from the above image retrieves data from JSON results.



The last 2 steps we had to implement in order to increment the loop.




The entire Workflow steps combined here as below.



No comments:

Post a Comment