Skip to main content
Nintex Community Menu Bar

I’m trying to create a query list action on a workflow that pulls back the IDs of all the items created by the initiator in order to delete the old items if they exist.

I’ve added the query list action, but when trying to pull all the item numbers into a collection variable, it doesn’t pull any numbers through at all.  The filter is searching the ‘user’ column on the list, with the ‘user’ being a variable that’s set previously as the initiator.

I’m using Nintex for SharePoint on-premis, after i’ve got the list of IDs that are created, I need to be able to delete the oldest one(s). so there’s only 1 item for each user.

Is anyone able to assist me, so that I can get this workflow working for the client.

Is this a site or list workflow?

Have you tried inserting a reference variable to the Initiator instead of the “user” variable?

I would also suggest using a “Log in history list” action to write and compare the values returned for the User list column and the user variable.


Hi @DonnaA,

I was going to say what @bamaeric said.
Log your user variable and then query a user on the list, and then log that and compare.
One may be a First Name Last Name, and one may be an email address, etc, so they are different and will never match.


It’s a list workflow.

I’ve already done the output of what the user field shows and it matches what is in the Initiator, although I am using the ‘Contains’, rather than equals to


This depends on the format the Person or Group variable [user] is set in. I struggled with this as well. Try the following:

  • Make a set variable action to define a second Person variable (let’s call it UserID), and set it equal to Workflowdata variable euser], put this before the List Query action
  • In this set variable action, next to the line where you equal it to the euser] variable, there should be a button with three dots on it, click on that to select a return type
  • Pick user id-number from the options.
  • Use your List Query action to check the column against this new wUserID] variable instead of the euser] variable.

Thanks, That’s worked perfectly. Now i need to work out how to delete all the old items, and keep the current one, any ideas?


I think the easiest solution would be to instead of List Query use a “Delete multiple items” action. It uses the same filters as List Query, so you could pull up the old items in the same way. If you want to keep the current one, I’m assuming that’s the item the workflow is running on, you could add a second condition, like:

Condition 1: User equals UserID]

AND

Condition 2: Id does not equal tId]

This excludes the current running item from being pulled out and deleted.

 

If the Delete multiple items action doesn’t work, (it has been buggy for me) you can also use a For Each loop after the List Query (and exclude the current ID through the List Query), then use a standard Delete item action by matching the ID to the one currently in the For Each loop.


Thanks, i’ll give that a try


Reply