Skip to main content
All CollectionsBubble FeaturesQuick Tips
How to Use the "Result of..." Expression
How to Use the "Result of..." Expression
Updated over a month ago

Transcript

In this Quick Tip, we're going to learn about the "Result of..." expression. "Result of..." will only become available in actions that follow step 1, as it is used to reference the result of a previous action in a given workflow. This expression can be especially useful if you are creating a new thing, or performing a search for a specific thing in one action and want to source data related to that same thing in a subsequent action!

The example I've been using here is a simple ToDo app. Let's use this app to see how the "Result of..." expression can be useful when creating a new thing.

When a user clicks this button to create a new ToDo, I first want the step 1 action of my workflow to create a new ToDo in my database using the information the user has inputted. Now, here in step 2, I want my app to send an email about this ToDo to the ToDo's creator. So I'll go ahead and add the "Send email" action, and because this action follows step 1, the "Result of..." expression is now available! So I'll choose the "Result of step 1's (Create a new ToDo...)'s Creator's email" for the recipient. I've even gone ahead and referenced the result of step 1 a few more times in the body of the email.

As we can see in this example, Bubble will automatically provide the appropriate fields based on whatever the "Result of..." expression evaluates as. So if the expression evaluates to a number, you can perform mathematical equations with that result. Or, if it's a list, you can add or subtract items from that result. And the same will be true for whatever custom type the result evaluates as.

It's also important to note that you can use this expression to source the result of any applicable step previously executed in your workflow, even if you have, say, 10 steps in your workflow; step 10 could grab the result of step 3, if that step results in relevant data (not all steps will be applicable).

One significant advantage of this expression is that it will ensure one action happens before another in your workflow. By default, Bubble triggers the steps of a workflow in the most efficient order, but by referencing the result of step x from step y, we can ensure that step x will be executed first.

Ultimately, the "Result of..." expression enables different steps of the same workflow to communicate with each other, and, if desired, will allow you to specify if a certain action in a sequence should be completed before another; all of which will help you to build smarter, more efficient workflows.

That's it for this Quick Tip! For more, be sure to check out bubble.io/academy.

Did this answer your question?