Trigger Bot only when table is updated through a specific form

Hi all

Basically as the title says.

Is it possible to read out the name of a form view that was used to update a table?

I would like to create a bot that only fires when the table is updated, but only if the update was done by a specific form view.

Is this possible?

Thanks in advance.

Adrian

1 17 887
17 REPLIES 17

Please try below approach. 

1. Please add a number type column called say [SpecificForm] with initial value 0 and show_if turned off. This column needs to be added in the table where the specific form is based and needs to be included in its slice, if the form is slice based.

2. Create a data change  action called say "Form Trigger"  on this table that changes the column  [SpecificForm] with the expression 

IFS(CONTEXT("View")="The one specific Form",[SpecificForm]+1)

3. In the BOT automation , please add a condition 

AND([_THISROW_BEFORE].[SpecificForm]<>[_THISROW_AFTER].[SpecificForm], ISNOTBLANK([_THISROW_AFTER].[SpecificForm]))

4. If there are existing rows in the table, please set the initial value of newly added column  [SpecificForm]  to 0 in the backend for those rows.

You may need some tweaks depending on how exactly the app is configured.

3X_4_f_4f39c62dc119e1ab0ed8b14b32c1b54e3f322d3e.gif

I use a similar method, except I use a text column.

For me, it makes clearer sense to put a word (or phrase) in the text column as the trigger for the automation.

  • [Automation_Trigger] = "Send Invoice"
  • [Automation_Trigger] = "Email Client"
  • Etc.

Same thing, different way.  😉 #GottaLoveAppSheet

Another benefit of using a Text column:

  • My automation trigger becomes a simple equality:  [Automation_Trigger] = "Email Client"
    • no need to check [_ThisRow_Before] or anything.

----------------------------------------------------------------

Just thought of another thing:  having a blank field that's a text type on a row, gives me space to set a temporary variable if I need to.

One re-purpose of the [Automation_Trigger] column I've done in the past, is to utilize it in a way to allow someone to "Reset" a field after they've changed it.  Something like:

  1. Hit the toggle to "update the date of the meeting"
  2. The date field becomes quick-editable
  3. Click the confirm button to save
  4. Click the cancel button to undo your change

It's the presence of that extra text field, with no other purpose really, that gives me the space to hold that temporary variable (the original date of the meeting) - so if a person cancels their edit (and they've already changed the value), we can put things back where they were... because we've got that value stored in the [Automation_Trigger] column.

Many MANY uses for an extra column like this; so much so I've got 2 in my standard starting template.

You can learn how to create a similar (cancel button for quick edits) here 

Hi @MultiTech ,

Thank you. Always good to know options. Could you update how the trigger works if the same BOT  needs to be fired multiple times? What will be  trigger in such cases? If email is to be sent multiple times for example on the same record?

I would configure the bot to send the emails, since we've got a list of emails.

One record, one trigger - of course there's bound to be nuance that will need to be taken into consideration.

But generally I find this sort of setup much easier to implement into the flow of my app.  Things become pretty straight-forward:

The automation triggering action (the one putting the keyword into the [Automation_Trigger] column) has a condition on it so it only fires off when I need it too - and these conditions are usually pretty easy (order status = complete, etc.)

----------------------------------------------------------------------

If you had X number of records, each needing an automation to run, this setup would work the same way - because the trigger is per record.

Hi @MultiTech ,

Thank you very much. Will keep in mind your suggestions for sure. Always good to know alternative thinking and options.  I learned to use the number column from the following part of the help article and I have so far found it working in majority situations, especially if the record is to be emailed multiple times.

Since there are good insights from you in this post thread, just thought of adding this perspective also for any future reader of the thread.

Help Article : Example automations - AppSheet Help

Suvrutt_Gurjar_0-1658069159165.png

 

 

That method, from the documentation, brings with it the ability to count the number of times an email has been sent.  #Nice 

That's much simpler than how I do it (creating an enumlist column to hold a list of values, where the value is a timestamp + some helpful data).

 

Btw, afaik, the new docs include some of the tips and tricks from the community

Yes, that is correct @SkrOYC . I have also seen links to Tips and Tricks in help documents.

Correct. Showing number of times email sent is an added advantage and incidentally,  yes I have used that option  as well. 

Thanks to both of you @MultiTech @Suvrutt_Gurjar , that thread helped me a lot.

I'm now running into the following problem:

  1. Grouped Action
    1. Set [Automation_Trigger]="Yes"
    2. Open form to edit the row
  2. Bot
    1. Checks if [Automation_Trigger]="Yes"
    2. Add a row to another table
    3. Set [Automation_Trigger]=""

My problem is that it adds two rows to the other table. I guess because I update the table two times. I'm not able to come up with a solution for this. Could you guys help me out again?

Really appreciate your help.

Thanks a lot.

Adrian

 

You could have the first action of the grouped action, that is

Set [Automation_Trigger]="Yes" as an event action on the form save after you edit the row.  You then do not need the grouped action. And the bot should trigger on [Automation_Trigger]="Yes"

I'm having a hard time getting my head around your solution. Could you elaborate more?

Sorry. I will try to be more elaborate .You are correct that for such tricky questions, requiring long responses, we can always have challenge understanding each other's descriptions.  🙂 

It sounds you have a form that you edit when you mention 

Suvrutt_Gurjar_0-1658138717906.png

When you save this above described form form, you can invoke the action that sets 

Suvrutt_Gurjar_0-1658138604989.png

 as an event  action on form save event . Please see how you can set the form event actions in the footnote screenshot. Since you are setting this 

Suvrutt_Gurjar_1-1658138619645.png

action as an event action , you do not need a grouped action.

Footnote: Event actions automatically invoke when you perform the respective events without needing user to specifically invoke them. In this case, the "form save" event action automatically invokes when the user saves the form after editing. The screenshot below shows where you can configure the event action in the form view.

Suvrutt_Gurjar_1-1658139043182.png

Related help article:

View events - AppSheet Help

Hope this helps.

Thanks a lot, I understand that now. I didn't think about the Event Action that you can set in a form.

It works fine now. What I can't really get my head around is, that it still are two changes Syncing. Do these two syncs count as one update to the table, when the action is invoked through the Event Action?

Nice to know the progress.

I believe those two syncs are 

1. Form save 

2. The action to set the trigger column.

Could you confirm in spite of these 2 syncs shown, the row added is only one.

Yes, the row added is indeed only one. That made me curious, as the other solution (with the grouped action) also produces 2 syncs (and 2 added rows).

Instead of clearing the trigger word using an action inside the form save event, put the trigger clearing task as the first thing that the bot does.

So you have a form save event, with your automation trigger action inside it. Then you have an automation that's triggered by that, where the first thing it does is clear the trigger, then continue on and do whatever it was supposed to do.

With this setup, the trigger only produces one sink, as the clearing of the trigger word is part of the sink action that's happening on the server.

Top Labels in this Space