Forum Academy Marketplace Showcase Pricing Features

How to create a new item just in case it doesn't exist, otherwise modify the original item

I have 2 inputs:

  1. “item name”
  2. “item number”

At the moment when button “save” is pushed, a new item is created with 3 fields: 2 filled by the 2 inputs. and another field has the “current user” added (this field is a list of all the users having the same item)

the problem is that I want this to happen just in case there isn’t already a item with the same “item number”.

If the item with the same number already exists, I just want the “current user” to be added to the list, and “item name” field to be filled if it was empty in original data.

Thanks!

I would use the workflow called ‘Make Changes to a Thing’ and check off the box ‘Create if thing doesn’t exist’

Then to reference the thing you want to change I would ‘Do a Search for Item’ and put the constraint of Item Number = Input Item Number

If an Item exists with that Item Number it should make the changes to it, and if the search does not find an item with that number then it will create a new

Can be confusing writing this out, but did that make sense?

Hello @gf_wolfer thank for your attention first of all :slight_smile:

It is going better, but still not: let me explain as clear as possible:

I can not use make change to thing because the result of “the search for” is considered a list of thing so i get this error

I solved it using “change list of thing” and it works but there is no “create if the thing doesn’t exist” (first problem) so it just works if there is already an ITEM (LIBRO) with the same ISBN (ITEM NUMBER):

Regarding the second step of adding the item to the current user list of item I tried make “change to thing” user–>list of item–> add --> result of step one. and I get this error:

So I tried user–>list of item–> add list–> result of step one. no error message but it doesn’t work… nothing is added

I would really appreciate if you could help me understand.

Thanks!

Use the :first on the search list to convert to an item to allow you to edit it.

Also, you could have to parallel workflows and you can do a check to see if or if not the item exists and the ‘and when’, then modify each workflow to manage the different conditions. When commonality exists between the two workflows break this out into a Custom Event which can be triggered by both workflows.

hi @DaveA

but if use :first I get the first item of the list right? not the specific one I’m trying to modify… sorry I miss some background I’m trying to catch up.

I will have to think longer on the second part of your advice

Thanks!

If you are searching for an ISBN, there should only be 1 result, the :first one…

Re-reading your original problem statement, I would say the ‘create if not exist’ is a viable option or the parallel workflow with a pre-condition check of the ISBN number existing or not.

Ok I will try the different options thanks @DaveA

Sorry I forgot the :firstitem
Should work fine with that added

1 Like

It does, thanks

@DaveA could you please give me a simple example on how to set up parallel workflows?

I coudn’t find much in the forum and have no idea how to start.

Thanks!

You set two different conditions for the same action in the workflow, for example, I have a save icon on a form, when it is clicked it depends whether a checkbox is checked or not as which workflow is run;

The workflow actions are then slightly different depending on which path is followed.

1 Like

thanks @DaveA understood perfectly :wink: