Solved

Create Approval Task with Users Queried from Different List (Conditional)

  • 3 August 2020
  • 3 replies
  • 6 views

Badge +5

Really struggling to figure out how to implement this.

 

I have a User list that stores people who will be doing various things within the workflow.

Users:

Name (People Picker) Department (Lookup Choice) Role (Choice)

 

 

In my Nintex Form, the user can select multiple departments they think their request will impact

Intake Form:

Impacted Department (Lookup Choice - Multiples Allowed)

 

 

Objective:

Assign an approval task to people who are Portfolio Coordinators (Role) in the impacted department(s) selected by the user on the form.

 

 

Issue:

I did a Query List action on the Users list, pulling two columns: the Name column and Department column WHERE Role = "Portfolio Coordinator". It puts this into a Collection variable.

 

Because the Impacted Department field in the form allows multiple selections, I'm unsure how to assign an approval task to the people whose Department equals one of the Impacted Department selections in the form.

 

So far I have:

  1. Converted the selected values from Impacted BSA into a comma-delimited string
  2. Split the string into a collection using Regular Expression action
  3. Query List on the Users list using the conditions I outlined above (pull in the Name column and Department column where Role = "Portfolio Coordinator")

And that's as far as I've been able to go. I don't know what to do now with it.

 

Thanks in advance for your help.

icon

Best answer by satishkumar529 7 August 2020, 17:35

View original

3 replies

At step 3: Loop through the collection of selected values.


     step 4: Query user list to get only the name column(get email) and store in a variable (let's say userEmail)


     step 5 : Build string action: userEmail + ";" + approverEmail  store it in approverEmail variable


     


End the loop. 


 


Now you will have all the emails of the approvers in approverEmail variable which you can use to assign task. 


 


Hope it helps.


 

Badge +5

Thanks for your reply!


I tried this but the output is in this format:


[{"Name":{"Title":"Smith, John"}}]


 


So a concatenated string would look like:


[{"Name":{"Title":"Smith, John"}}];[{"Name":{"Title":"Doe, Jane"}}];[{"Name":{"Title":"Kid, Billy"}}]


 


Is that string acceptable in the Participants field for assigning tasks? Or will it throw an error at me because it isn't in a strict format like johnsmith@company.com?


 


Edit: I tried it but when it gets to the Assign Task action, it throws an error. Wondering if I do some Regular Expression actions to cut out some of the bracketed fluff.


 



An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ArgumentException: AssignedTo at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Exception from activity Throw If Sequence NintexActivities.WorkflowXaml_34ba3517_fe61_4962_98b8_fcddb8d6bdd3 Assign tasks to Assignees Sequence Flowchart New


 






Badge +5

Oh boy I think I found the issue. In the Query List action, I need to select "Separate Output as Columns". It now is working correctly!

Reply