I am trying to use a Nintex workflow to create an item in List A upon submission of a form from List B. I would like to Query List A and check if an item exists based on a practitioner's email address. For that I have used Query action in Nintex workflow to filter based on email address. I am storing the ID and email address address using collection variables and finally using a 'For each' loop to store the collection ID value in a single line of text variable. However, I am not sure how I could let the workflow check a condition in Run if action to look for an item in the List A based on the email address and if an item doesn't exist, then create an item in List A. I have added screenshots for your reference. Please advise.
I guess for this you don't need query list action. Write an workflow in list B, on item submission.
1. Set variable action get the current item practitioner email address.
2. Using Run If or Set a condition-from current item-list lookup-list A-practitioner email address-equals-current item email address(check the type you want display name or email address). If it is not found create an item in List A.
But my suggestion is email address is not an idea.
Thank you for the quick turnaround. There are multiple items in List B with the same email address. So we need to use Query action and check in List A if there is any item existing with that email address as a reference. If yes, create an item, if no, update that existing item. The item needs to be created in List A when a form is submitted in List B.
You need to check- when a form is submitting in List B the email address field value is present in list A or not. correct? For this Query list action is not required. Rather you want it in a reverse condition like, When an email address in List B is present in multiple items in List A then if you want to get all items as a collection as below.
You want to write a list workflow in List B.
Using Collection operation you can get count and store it in a workflow number variable.
Set a condition If count is 0 then create item in List A, else update all items using for each item action.