Skip to main content

I have a List of approvers in a sharepoint list and I am trying to create a dynamic list so that additional approvers can be added at any time.

 

13827i81040A56CD797797.png

 

I am attempting to create a reference using this list, and when I create the reference I can filter to just the items where Archived has a Value of No.

I want to use the list reference in a For Each, but I want it go through the list in the correct sort order.

Can this be done?
If so, how?

It looks like out of the box if you create a reference usig the Get List Items method, and you used that reference in a for each loop, it will cycle through the list items in order by their list item ID.


17095i1DD301C72986687B.png

Hi HardieK2,


 


Unfortunately the create reference does not have sort function.


 


Use the following site to log a new idea with K2:


 


https://ideas.k2.com/?sort=popular


 


You will need a portal account to be able to log new ideas


I believe I may have found a workaround: http://community.k2.com/t5/K2-blackpearl/Smart-Object-Method-with-a-sort-K2-Studio/m-p/98523/thread-id/32374/highlight/false#M32375

If I throw this string into a for each loop, I believe it will process the individual items in the order that the string is structrued in.

I will report back after I have modified the workflow and tested to verify that the for each does run in the specific order.


  1. Add a Default Activity to your workflow. 
  2. Select the Destination Rule and run in advanced mode
  3. Select "Plan Per Slot (No Destinations)"  
  4. Select the option "Select a list field to determine how many slots should be created"
  5. Drop your SmartObject list event in the box.
  6. Add your inputs and filter. In the return property select the ID for the SmartObject. 
  7. In the List Options select the "Order Results By" and choose  Ascending and theSort Order field property. 
  8. Add a data event to the Activity to build the list based on the data events
  9. Then in the next activity, Create another data event to format the list:
  10. Then you can feed the IDs into the for each loop using that string: Example of string: 1;2;3;4;5
  11. In the first activity after the For Each, create a reference to the list item you needed to use in the loop using the item id.

    See the attached word doc for screen shots.

    This is how you can do a serialized for each loop.

Reply