*This tip will let you trigger a workflow without having to double back and clear the trigger column.
Let’s create an action to trigger a workflow that sends an email.
CONCATENATE("UNIQUE_KEY_WORDS", " - ", NOW())
PROJECT_SUMMARY_EMAIL
This ensures that we can use our trigger column for many different types of triggers, and that we can also trigger the same workflow over and over without needing to double back and clear the trigger.
While I prefer to clear the trigger column, this way there’s no ambiguity around when a workflow should be triggered or not, this method provides a sort of history for what the last trigger was; nice one!
I generally prefer any method that has less moving parts/data changes.
Clearing the trigger method would be three actions, and two table record updates.
We often carry SQL change/history tables, so the second update to clear the record creates a “non-user” created second record update in the change table, useless… I should experiment with marking the trigger column to “reset on edit,” but it’s not really necessary. (Try to get the trigger history record to only show up for the person that used it, so I could get a history of workflow triggers)
Just two actions, and one update:
Since we can do multiple steps inside workflows, the first step I do is to clear the trigger inside the workflow - this means the only edit made to the row that we see in the app is the push of the trigger - everything else happens with the workflow.
I’m with you 100% about less moving parts.
Nice use of StartsWith() BTW
Ahhh, yes, yes.
It’s still two database updates.
Hi @Grant_Stead and @MultiTech_Visions !
Both of you have far more experience than me on AppSheet (I made my first “contact” to AppSheet at the end of 2019 and started full on January 2021)
I made something similar but with a number column that gets +1 with my action button and the bot has this condition:
[_THISROW_BEFORE].[UPDATE_COLUMN]<>[_THISROW_AFTER].[UPDATE_COLUMN]
I also tried with >
instead of <>
The problem is that I have two of the same setups and one of them always triggers the bot after I change any other column from that row.
[_THISROW_BEFORE]
and _AFTER
works?[UPDATE_COLUMN]>NOW()
as condition so I would bypass the _THISROW_BEFORE and AFTER stuff completely. Do you think that would work?Thanks in advance!
However, we’d need to dig deep into your stuff to figure out why exactly it’s getting triggered when you don’t want it to. Drop a loom…
Instead of trying to do all of this clever stuff, I stick to a crazy simple scheme.
Create a column that’s hidden in all respects, that’s a text type, in which you can put specific triggers. I’m talking about creating a specific action that sets a specific value to this column, then you base your automation triggers off of the fact of this column having that specific value.
As long as you remember to clear the trigger value before finishing the automation, this system has never led me wrong. There’s no confusion to be had about when something should fire or not.
I’ve created systems where I’ve tried something like what you’re doing, where I will try and come up with some formula that can detect the change that would trigger the automation.
Are you forgetting to check if it is not blank as well? A blank value will result in a BEFORE <> AFTER
being TRUE. Or at least it did in the past maybe the recent-ish change for comparisons against blank values fixed that?
For the record, I do almost exactly what Grant described in the original post here. Although I never saw this thread before, and this is probably only the 2nd time I ever even heard of the STARTSWITH() expression, brilliant! In fact this template condition expression is even saved in my clipboard manager for super easy access.
AND(
ISNOTBLANK( [trigger] ),
[_THISROW_BEFORE].[trigger] <> [_THISROW_AFTER].[trigger] ,
INDEX( SPLIT( [trigger] , " ; " ) , 2 ) = "xxx"
)
Intended to trigger on a data-change Action like:
UTCNOW() & " ; " & "xxx"
There it is! I tested both of my tables that has the setup I described above and both of them trigger the event when the column is blank.
I guess I’m gonna make them default to 0 or change it to a more elegant solution as @MultiTech_Visions and @Grant_Stead are doing.
Thanks again @Marc_Dillon. I told you that you were a very helpfull person!
Yes, the method I outlined is far superior…
That’s exactly why I put a keyphrase in the beginning. So that you can use one trigger column but have many different triggerable events.
Thank you very much to both of you for your time.
@Grant_Stead For sure that’s superior, with my actual setup I would need one column for each of the actions/bots. I don’t need that flexibility for the moment, but I’m a litle bit tempted to use your trick in the future.
@MultiTech_Visions I also like to make things simple sometimes. I can see how the two-steps thing would help since after the action/bot is trigger the column would be blank again and then the bot shouldn’t be triggerer again by accident. Am i right?
Also, just the fact that there are two changes to the column (the first one with the trigger value and then the one that clears the thing) is enough for AppSheet to notice that there was the trigger value and do it’s thing (bot-side)?
Also, have you encountered a moment where you would prefer to make an adds only event instead of a update one just for reliability reasons? I’m asking that because Adds Only works perfect every single time but personaly I have struggled with Updates Only ones to the point that I’m thinking on not use them anymore. Should I just keep debugging and not give up with Updates Only events?
Thanks again!
Hi,
Have used the above method to trigger emails but I have the problem that my users often update the row in which the trigger column is located after they have hit the action button that sets the trigger column.
I have this as the action
CONCATENATE(“Products”, " - ", NOW())
and this as the condition
AND(
[_THISROW_BEFORE].[Send Stock Email]<>[_THISROW_AFTER].[Send Stock Email],
STARTSWITH([Send Stock Email], “Products”)
)
It works great as a column that can trigger different emails but there is no option to only trigger on an update in a certain column only.
Even if I set the trigger column to " " after the email is sent, the condition is met long enough for the user to make edits and trigger more emails.
Thanks
phil
So as soon as a user hits the action, the app begins a sync process - thus preventing them from doing anything else, and also speeding up the execution of your automation (as it’s being forced to run NOW).
The app has about 24K rows and 40 tables and takes about 1 miute to sync so would slow down all the users too much. I can’t break up the app anymore to redcuce the sync time.
thanks
Phil
How is this a problem?
Not sure what you mean here. There absolutely is such an option, and you’re already using it; your bot is only triggering on changes in the [send stock email] column.
Not sure what you’re saying again. Are you saying that more emails are being sent out than what you’re wanting?
I assume this is the same issue as in your other thread:
Please describe in more step-by-step detail exactly what is occurring.
Let’s move this to it’s own thing…
omg I don’t know why I didn’t think about this sooner.
Hi,
I think the problem was because I added the clear trigger column as the last step in the bot rather than as part of a sequence of actions.
Problem solved.
Thank you