New feature: Trigger other bots

“We released in preview a new advanced feature that supports data changes happening in one Bot can trigger other Bots to execute”

Please see this page for detailed explanations: Creating a bot | AppSheet Help Center

Feel free to reach us if you are seeing any issues, or have any questions.

12 14 1,931
14 REPLIES 14

Thank you @Lusha_Wang1 for your works to bring this on our table.
We tested before and now re-tested with our sample app which is working fine.
Yes, indeed it repeats 5 times max to avoid looping endlessly.
Great job.
This is one of additional feature which we did not have at the time of Ex-workflow, I admit.

@Takuya_Miyai

Exciting! I think this is a great feature, particularly the “Wait for execution”. I hope this can improve consistency for complex tasks that perform batch data processes or use the AppSheet API.

@Lusha_Wang1 how does the system handle recursive triggering of Bots? ex. Bot A performs a data change that triggers Bot B. Bot B then performs a data change that triggers Bot A.

Maybe @tsuji_koichi already described that it loops 5 times and then stops?

Hi @Stefan_Quartemont, yes, the bot triggering chain will stop after 5 times.

Yeah, two bots go on a rally - just 5 times

3X_6_e_6e69471115a5d76535de4ef337c13790a36f7983.gif

Hello

Will it be possible to choose specifically which other bots to trigger? Or specifically which bot Not to trigger?
Because when Deletes are involved in these workflows, if they are also triggered … well then it’s over.

Hi @sorin_mihai We don’t have an option to customize which bot to trigger or not to trigger. However, if deletion will be performed in the bot, and if you want certain bot not to be triggered, then you could make that bot not listening to deletion data change events. Please let me know if you have other questions. thanks

Hi @Lusha_Wang1 - can you help? I was thinking of going ahead and trying this - but thought the 5x limit might mean I waste my time... 🤪

In short:

Essentially I'd like to be able to trigger a bot on a set of rows (similar to executing an action on a set of rows, but having the action run server-side to avoid client-side user wait times).

Can we do this with this new feature, or will it only trigger the first 5 rows in the set?

 

In detail:

I have an action that writes a enumlist of user IDs into a column in my 'Invites' table.  I'd like 'Invites table Bot A' (triggered by the Adds-Only data change) to trigger 'Users table Bot B' which would update a column in the 'Users' table (with the triggered task-action firing only if the User [ID] is in the enumlist of user IDs in the 'Invites table'), to then trigger 'Users table Bot C' which would send a personalised email to the user.

Is it possible with this new feature, or will my table B Bot only run for the first 5x rows that have the data changed by the table A Bot?

 

Alternatively is there a way to make this work with the process step 'Call a process'? (this is poorly documented).

 

Reason for all of this is that I want to be able to send personalised invite emails to a bunch of users in my users table (hence run Bot C for each row), and I'm trying to avoid executing a data change action on a set of rows on client-side - because if the user wants to send personalised invites to say 50 users, they then have to wait for 50 data changes to sync for each change to then trigger the Bot C.  I'd rather have a single data change (enter enumlist into a single row in the invites table), a short wait time for the user; and have the necessary multiple data changes on the users table occur in the background and send the emails...

@Bellave_Jayaram 

@Lusha_Wang1 @Bellave_Jayaram 

So like this...

  1. 'Invites' table has columns [ID], [InviteUsers], [InviteDateTime] (plus some others, except for brevity's sake)
  2. 'Invites' table gets a new row added with [InviteUsers] being set to an enumlist of say 'dhe72jcu , 4su72yd8 , 58dj33d8' (in this example just three User IDs from the 'Users' table)
  3. 'Invites table Bot A' is triggered by the new row add, and contains a process with a single step to execute 'Invites table action A on a set of rows', the rows being found in the 'Users' table.  These rows would be:
    Select(Users[ID],
         contains(
                          lookup(maxrow("Invites", "InviteDateTime"), "Invites", "ID", "InviteUsers"),
                         [ID])
                   )
    {EDIT - this would be simpler!} Select(Users[ID], contains([InviteUsers], [ID]))
  4. The action invoked on the selected rows of the 'Users' table would be to set column [SendInvite] to a value say "Send Now" (anything really)
  5. 'Invites table Bot A' would have the 'Trigger other bots' option turned on
  6. 'Users table Bot B' is triggered once for each row that has been changed by the action on a set of rows caused by 'Invites table Bot A'
  7. 'Users table Bot B' sends a personalised email to the user row in each case, and as a second task sets the value of [SendInvite] from "Send Now" to NULL.

Hi @Ed_Cottrell , first, the 5x limit means we only allow the bot triggering chain at most to be 5. It doesn't mean 5 data changes at most. So All the changes inside bot A would be able to trigger bot B.

 

See this documentation for more details: https://help.appsheet.com/en/articles/4865431-creating-a-bot

  • Trigger other bots - Enable this option to allow data change steps in this bot to execute other bots that are listening for the same data change events. Disable this option to prevent data change events triggered by the current bot from triggering other bots.

    If enabled, the following policies are enforced to avoid infinite event-trigger loops:

    • An event that is a result of a data change made by the bot cannot subsequently trigger the same bot.

    • If two or more bots trigger one another continuously in succession, the maximum number of triggers that can be initiated between them is 5. For example:

      • Bot A triggers Bot B

      • Bot B triggers Bot A

      • Bot A triggers Bot B

      • Bot B triggers Bot A

      • Bot A triggers Bot B

We will have a new step type available in one or two months, which will support given a set of rows, call a child process. Will let you know once it is publicly available. thanks

Hi @Lusha_Wang1 ah thank you. Actually I did find the help article after I write this - I’m sorry about that, I hadn’t checked those automation docs for a while and they have been further updated/added to it appear.

Also I went ahead and tried my two bot method above with the action on a set or rows in the first bot triggering the second bot multiple times: it worked well!

It did require adding the extra column to identify/tag the rows to be acted on however - so if you are building a ‘on a set of rows’ type bot option that would be great in future as it would avoid having the extra column.

It would also be great in future to be able to have a simple event on table A trigger a bot in Table B, (single Bot) , the call a process option doesn’t seem to allow this.

 

 

@C-Connect Glad to hear that bot-trigger-bot works for you. Thanks for providing feedbacks. 

@Lusha_Wang1  sorry I replied with a wrong account! (C-Connect) Thanks 😊 

Hi @Lusha_Wang1 hoping you can help again? I can't get a scheduled bot to trigger other bots.  Is this normal behaviour?  (I.e. Scheduled BotA which changes data, and that data change is the same change event that BotB is listening for which should then fire... but it doesn't). Thank you!

Top Labels in this Space