Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to "for each" a group of Persons in Nintex Workflow for 365

Jump to solution

Hi guys

Is it possible to use a "collection" of Persons you used to send Tasks too as a variable to loop through in the workflow and person a serie of actions for each of these collection of "Persons".

To illustrate above question: I have created a list in which you create a meetings between a Manager, a group of people and a consultant (Peers/Superiors). The Peers/Superiors is a Column of Person or Group which allows multiple values. When you submit a list item it assigns a task to all people in the before mentioned group.

So far so good. Now when the task is approved it should start looping through the Persons in Peers/Superiors and perform a couple of tasks ( like: Make a calendar entry per Person AND create a new Item in the another list in a form needs to be filled in.

The text in bold is the thing I can find a solution for. I've tried putting the Values of Peers/Superiors into a variable of type Collection and For Each though this and perform the actions in the body of this loop... but no success.

Any help is appreciated.

Kind regards

Labels: (1)
0 Kudos
2 Replies
Workflow Hero

Re: How to "for each" a group of Persons in Nintex Workflow for 365

Jump to solution

This is how I do it :

1 - Get your multi users "Peers" property into a collection "UsersCollection", with a Query configured to get Workemail of Peers users. You'll get something like :


2- Use a regular expression to tranform :  [{"Peers":[{"UserName":""},{"UserName":""},{"UserName":""}]}]  into   ["","","" and store this in a new collection named "UserEmailsCollection"

The pattern to use in EXTRACT action is :

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?Smiley Sad?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?Smiley Sad?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]Smiley Sad?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

3- You now have a "proper" collection of user emails, on wich you can do a for each loop (UserMail is a text variable for me) :

Hope this helps !!

Workflow Hero

Re: How to "for each" a group of Persons in Nintex Workflow for 365

Jump to solution

Thank you for this! It was extremely helpful.

The only issue I had was that your regex didn't match emails for me, 100% of the time. I am no regex expert, but for some email addresses, it just wouldn't match, or only partially match.

I found that this regex pattern worked better for me:


Thanks again. I never would have thought of using a query action for this.

Side note: Long term, I think I have an easier way to do this, but I'm waiting on a bug fix from Nintex before it will work. It involves being able to pull the multiple person column directly into a semicolon delimited string, and then splitting it into a collection.