Skip to main content

Hi all, I want to do some fairly complex actions when my users create a new record, and in certain circumstances block them from creating it.

Here is the logic that I want to run when I create a new record:

  • If FieldA is not null

    • Look for a record with matching FieldA

      • If such a record is found, do not add this record, stop 🛑

      • Else:

        • If FieldB is null

        • Fetch BValue from external source with a script that takes FieldA as input

  • If FieldB is now not null:

    • Look for an already existing record with a FieldB value that matches what I found

      • If such a record is found, do not add this record, stop 🛑

      • Else, update this record with the new FieldB value

The first issue is that I have nesting “IF”s here. And I cannot seem to nest IF statements in the automation interface. Is there a way to implement nested-IF logic in an automation other than by creating a custom script? 

The second issue is how to delete the triggering record. Is there a way to do that in an automation, other than by creating a custom script that calls deleteRecordAsync ?

Hi there!

This is a complex logic you’ve got here! I think it would be useful for you to share more context on the actual goal of the process and the nature of the data being used since I sense there can be a simpler way to acomplish this.

As the process is described, you could have it all within one automation by:

  1. Running all “Search” action blocks at the begginig of the automation, before we know which is the final result:
    1. “Look for a record with matching FieldA, even if FIeldA is null
    2. Use a script block to Fetch BValue from external source (just return None if FieldB is null)
    3. “Look for an already existing record with a FieldB value that matches” even if FieldB is null
  2. With all of these resutls you can combine with “FieldA/B is empty” to create all the scenarios in one single IF-Else If-Else conditions (not nested) to execute the final resutl.
  3. To delete a record you will need to do it with a Script block.

Let me know if this makes sense,

Best regards,

Matt Nixon


Deleting records is only possible with scripting, or by using a low-code automation tool like Make’s automations for Airtable.

I don’t know scripting, so I use Make for things like this. 

If you’ve never used Make before, I’ve assembled a bunch of Make training resources in this thread. For example, here is one of the ways that you could instantly trigger a Make automation from Airtable.

Hope this helps! If you’d like to hire the best Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld


Reply