Skip to main content

I have two lists that I am working with. The main one has my Nintex form on it. The form has multiple people picker fields on it. What I need to do is after the form is submitted, I need to see if the people entered on the form exist in a secondary list, if they are not there already, they need to be added, if they are there, then do nothing. 

I was trying to push all of the names into a collection variable and then query the secondary list to see if any of the names from the collection exist on the list but I can not figure out how to make this work.

Any ideas?


Thanks! 

Ok, you're definitely on the right track! I would say get all your people in a collection variable. Then, do a "for each" and say, for each of these items, query list for an item where person == this person. Get a count. If count == 1, do nothing. If count == 0, then add this person (create new list entry).

So overall it will look like this:

206785_pastedImage_2.png

This biggest thing to watch out for is how your people variables are formatted (make sure you're consistently using display name, or login name, or whatever).

Here's each action opened up:

206786_pastedImage_3.png

206787_pastedImage_4.png

206788_pastedImage_5.png

I would also log a bunch of stuff, like your queryCountVar (make sure you list doesn't have duplicates, you could build in logic to help with that. Like using a switch instead of a conditional, and having queryCount ==1 do nothing, == 0 create person, and == anythingElse log it and email you, because that would mean there's a duplicate person in there). 

Let me know if you have questions!


Thank you for the help. I have a couple of questions. First, it looks like you are using office 365? I have on prem, so my workflow actions look a little different. for example, my query list action does not have the option to have a separate output per column. 

206791_pastedImage_1.png

Also, is the variable you used in your filter section your collection variable?

Thanks!! 


Oops! Sorry about that, how you have your query structured should be just fine.

I am not using the collection variable to sort. The "for each" output value I am using is simply text. So, if our collection was something like [Bill Rogers; Ricky Martin; Ozzy Osbourne] then on the first loop, that output value would be Bill Rogers, the second loop Ricky Martin, and the third Ozzy Osbourne. Hence, why we can look in your list to see if that person already exists! happy.png 


Hi Leah Giambartolomei‌,

Can you try the following way.

1.  'Set Variable' - get field value (multiple person display names)

206930_pastedImage_3.png

2. 'Regular Expression' - split multiple names with by a semicolon and store it in a collection variable.

206931_pastedImage_4.png

3. 'Collection' action count operation - see single person or multiple persons store it in number variable.

206932_pastedImage_5.png

4. 'Query List' - fetch 'List B' all items and store ids in a collection variable.

206934_pastedImage_7.png

5. 'For Each' condition on List B items collection.

206935_pastedImage_8.png

6. 'Set Variable' action - get display name of 'Person Field' from 'List B'.

206936_pastedImage_9.png

7. 'Set a Condition' - to see the count from step 3.

206937_pastedImage_10.png

8. Step 7: 'Yes' branch - check the value directly.

206939_pastedImage_12.png

      False means - use 'Update Item' action and do something. 

9. Step 7: 'No' branch

      9.1. 'For Each' action from collection in step 2.

206940_pastedImage_13.png

      9.2. 'Run If' action to check blank value.

206941_pastedImage_14.png 

      9.3. 'Set a Condition' to check the value exists or not.

206942_pastedImage_15.png

      False means - use 'Update Item' action and do something

Thanks,


what about to simplify it following way?

- make the list field unique (field's configuration setting)

- within workflow simply use create item in another site action to create new item without any former checks. configure error handling for the action. if an item doesn't exists yet, it is created and no error is reported. if it already exists, error is reported. based on the error flag you should be able to decide whether new item was created or not and proceed accordingly.


Reply