Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Multiple actions on click

Issue

I am using Appsmith Cloud and want to run an action with variables on click and then another action on its successful completion. I am unsure how to combine these two actions, but someone suggested passing an onSuccess function to the run function with the necessary arguments, which worked for me.

Resolution

The user wanted to run an action with variables on click and then, upon success, run another action. To combine these two actions, the "run" function with the onSuccess function can be used.

First, the initial action with variables is written using curly braces and passing the variables within those curly braces. For example: {{update_instantcallback_config.run({ state: “OFF”, queue: “de#issue” }) }}

Then, to add the onSuccess function to also run the second action upon success, the "run" function can be modified. This can be done using the following format: {{action1.run(() => action2.run(), () => {}, { variables... }) }}.

Finally, the user was given an example of how to implement this modification based on their previous actions. The example code was: {{update_instantcallback_config.run(() => scan_instantcallback_config_de.run(), () => {}, { state: “OFF”, queue: “de#issue” }) }}.