Asynchronous workflow issue

Hi All - I’m running into the following issue:

First, context: As many of you know, Bubble handles external APIs asynchronously. For example, we use Airtable for our database, so in a workflow that use Airtable API calls, Bubble will send Airtable its sequence of requests immediately upon execution of a workflow, without waiting.

That is creating the following issue that I’m struggling to find a solution for

  • When creating a new record (new client email), I first have it check that a record with that email doesn’t already exist
  • To do so, I have two workflows: first, the workflow when you hit the ‘add’ button, which then triggers the workflow (custom event) to add a client. That trigger is conditional on the client (the ‘owner’ in our db) not already being found in the database. See below for screenshot of the trigger
  • Unfortunately this isn’t working: when I debug, that conditional is always coming up negative. When I check the db the client IS being created.
  • My interpretation: it is firing the ‘create new entry’ custom event over to Airtable BEFORE checking the condition, so that by the time it checks the condition, the entry exists.

How can I solve this problem? Normally with asynchrony issues, I’d have one step ‘wait on’ another by checking its result (adding “result of Step X is not empty” to its conditions), but that won’t work here (because there’s no result step to check). Thanks for any advice!

Have two custom events. One is to check if the record exists. Set a yes/no return value on that custom event. Return yes if account doesnt exist and vice versa. Second custom event is where you do all the airtable stuff if the record doesnt exist. Trigger the second event only if the first event returns No.

2 Likes

That is exactly what I would suggest :point_up:

Thanks @maheshkasindi and @rpetribu - that solution worked! Using the Return on custom events works great!

1 Like