Check item exists before adding


Badge +16

Morning all

So I have a ridiculous requirement whereby I have to copy items from ListA to ListB if a condition is met in ListA.  i.e. if new item added to ListA with status of Live then copy to ListB.  ListB looks exactly the same as ListA but has an additional column called ListAID.

So when the workflow runs I need to work out if the item from ListA already exists in ListB.  Fine, happy with that, I query ListB filter by where ListAID = Item Property: ID and store the output in a list item variable vIDListBItem.

So now I need to know if vIDListBItem has a value.  I choose set a condition and configure as follows:

  • If any value equals value
  • Workflow Data:  vIDListBItem
  • {here is the problem}

The only comparisons I have are "equals" and "not equals".  I would like to say is not empty.  But that is not possible. 

Now I have a few ways in my head I can get around this, but I would rather not do them as I think I am over complicating it.  Can someone please tell me an easy way to do this...?  ‌ you always come up with tricks that I never knew about - how would you approach this?


3 replies

Badge +2

Hi Cassy,

I'm busy building a workflow to interface changed records. I stored the result of my Query List action in a single-line text variable. In my Set a Condition action I had the "is empty" option.

Userlevel 5
Badge +14

exactly what I was about to suggest.

I assume ListAID column in list B is of some numeric or single line text type. so it doesn't make too much sense to have 'item ID'-type variable in workflow for it.

so store it in text variable in workflow and you can easily check for emptyness

so no trick in this case at all.

hope you are not disappointed happy.png

Badge +16

I made the variable a string - was hoping there was a cool "does item exist" trick that I wasn't aware of.

Thanks both.  happy.png

Reply