Help

Re: Updating a record without overwriting a field (webhook trigger)

448 0
cancel
Showing results for 
Search instead for 
Did you mean: 
the_bugfather
4 - Data Explorer
4 - Data Explorer

Hi, 

I'm setting up an automation so that a webhook from another app (Instantly) triggers it. Webhook contains 'email', 'label' and other values. The goal is - when LABEL is added, it should create a record or update the existing one.

I want to set up the following but so far failed:

- After the trigger of adding a label...

- If a record with the same 'email' field doesn't exist - create a new record.

- If a record with the same 'email' field exists - update the record and its label but DON'T replace the old label - just add the new one in the same field with the old one (multi select)

-----

I think I managed to set up the updating part (pic below) but I don't know how to prevent overwriting the 'label' field when the record with the same email exists.

Any ideas?

Thanks!

Screenshot 2024-08-19 at 11.38.02.png

2 Replies 2

Hmm if you're okay with there potentially being an empty multiple select option, you could try to do this:

Screenshot 2024-08-19 at 7.16.05 PM.png

Resulting in this if there's an existing label:

Screenshot 2024-08-19 at 7.17.24 PM.png

If there's no existing label it looks like this though:

Screenshot 2024-08-19 at 7.16.13 PM.png

You could try to clean it up with formula fields or a script or something, but I figured I'd just give you the simplest option first

===
I'm not too sure about how you're doing the conditional; normally I'd check the length of the "Find Records" result.  If it's 0, then it couldn't find a record with that email so I'd make it create a record, does that make sense?  Still, if your thing works I reckon just stick with it!

@the_bugfather 

Not sure if you want to spend time learning another automation system, but this is pretty easy to do with Make's webhooks and Make's Airtable auotmations.

The reason that it's easy to do with Make is because Make offers an "Upsert Record" module that automatically creates a new record or updates an existing record (based on whether the record exists or not).

The screenshot below shows how this sort of an automation would be setup in Make.

Additionally, Make also allows you to specify formulas & functions WITHIN THE FIELDS themselves... so you can have an "if" statement within a field, and you can choose to append the current contents of a multi-select field instead of overwriting the contents of the field.

However, there is quite the learning curve with Make, so you'd need to learn how to manage arrays in Make because a multi-select field is an array field.

I give a demonstration of how to manage arrays in this Airtable podcast episode (although my demonstration covers attachment fields instead of multi-select fields).

Hope this helps!

— ScottWorld, Expert Airtable Consultant

Screenshot 2024-08-20 at 12.46.03 AM.png