Solved

Help needed getting field properties in Inner Loop for Site workflow

  • 29 November 2022
  • 4 replies
  • 12 views

I'm struggling with site workflows in Nintex Workflow Cloud and need some help. I have a document library and a custom list serving as a task list. The document library has a workflow that creates items in the task list and sends emails to Reviewers to complete their task. A document may have multiple reviewers and all reviewers must complete their tasks. I would like to run a site workflow every day to find tasks that were updated in the last 24 hours. Then compare the Approval Status to the other tasks in the list to see if all tasks have been completed for the related document which is listed in a lookup column in the task list.

 

As an example,
Document library has a document called ABC Contract.pdf and 2 people need to review it. Task list example shown in attachment.

My end goal is to query the task list and check the Approval Status column and if the approval status on all related tasks have the same status (and not Pending), then update the Approval Status column in the Document Library to that value. I can’t seem to figure out how to get the Approval Status for each of the related items to see if they all match.


The workflow queries the Task list to find all the records updated in the last 24 hours before looping through to find all the records where the lookup column document ID matches and add to a new collection. After getting all the records where the lookup column document ID matches, I get stuck trying to find the Approval Status for each. I have an inner Loop to loop through the collection of matching doc IDs and the only thing that I can get seem to be use is the entire object. I have attached a screenshot of the Loop for Each section of my workflow.

Why can only enumerate the objects in the inner loop? Am I going about it the wrong way?

icon

Best answer by Prineel_V3 29 November 2022, 12:01

View original

4 replies

Userlevel 2
Badge +8

Hi,



Im not entirely sure if this will be helpful or if I understand your scenario, but from what I gather, you already have a collection of the IDs that you need, you just need to get the status for each of those items. Instead of looping within a loop, you can create a separate loop to loop through the ID collection and use a "Retrieve an item" action to retrieve the status, then you can add the status to a new collection within the loop to create a status collection which you can then create another loop to check conditions (not entirely sure how you would check if all the status' are matched, but im sure theres a few ways to do it like using a boolean variable). So it would look something like this:



Loop for each 1 is just adding the IDs to a collection & Loop for each 2 is adding the status from the retrieve an item object to a new collection. Loop for each status, is looping through the status collection from the 2nd loop for each action. Let me know if you need to see the configs for some of the actions (if this is your scenario)

Thank you, @Prineel_V3! You have gotten me closer for sure. I'm still trying to figure out how to check to see if all values match but my initial road block.

Userlevel 2
Badge +8

Hi @cdpisdg ,



Just incase you are still looking for a solution for the checking the matching statuses part, this should work:
Use a get item from collection action to get the first item from your status collection and store in a text variable:



You can then loop through your status collection and use a branch by condition to check whether the all the other statuses are equal to the first item:






I just set a boolean variable set to yes/true or no/false based on if the condition was met which you can then use that boolean variable to proceed with your logic:



You can also use normal text or int variables i guess. Logically, this should also work with a run if action, however it did not work for me (not sure why) so I had to use a branch by condition action.

@Prineel_V3, You Rock!! Thanks for the additional information! I now have a successful workfow. I really appreciate you providing the last bit to get me there.



Thanks so much!


Susan

Reply