Run an automation when a button is clicked

Hi, we want to run an automation when a button is clicked.

Automations are much more powerful than the interface of a button and it would be such a game changer for our company!

Hi Raul,

Strictly speaking I don’t think that can be done, but you can achieve the same end result nonetheless.

(I’m not a Codan, let them correct me where I’m wrong here).

TL;DR: What you want is to create a button to run the same actions as the automation.

Both Automations and Buttons are things that run actions. Despite their interface being different, they’re equivalent. See this table for comparison:

Automation Button
Trigger When (periodically) Click or call from another Action
Conditional If Disable If
Actions Action Then [More Actions] or Formula Action or Formula

The first thing is the triggers. For the Automations you have a When clause that is checked periodically. On the other hand, Buttons can either be clicked by a user or pushed/called by another Action.

That’s why you can push a button from an automation rule, but not the other way around.

Another difference is that the conditional clauses on both are also inverted, so if on your Automation you have If [Formula], you need to set your button’s Disable If to Not([Formula]).

Finally, an Automation you can execute multiple actions by adding Then blocks. That method is not there for a button, but you can do the same with a formula. See RunActions.

Hands-on

So going back to your scenario. It seems to me that you want to get rid of the When rule, and instead trigger some actions by a click.

According to the table above then you need to get rid of the automation and just use a button instead.

Say your Automation rule looks like this:

When [trigger]
If [condition]
Then [action 1]
And Then [action 2]
...
And Then [action n]

If you click on the f on each Then block you’ll see the formula for each action.

Then [Formula 1]
And Then [Formula 2]
...
And Then [Formula n]

Now you create a button, and its action should be a RunAction formula containing all formulas copied from above:

RunActions([Formula 1], [Formula 2], ... [Formula N])

Maybe a pic can explain it better:


Just a final word for the Codans, maybe adding Then blocks to buttons would be a good idea.

3 Likes