Product changes

Return values from (sub) actions + bugfix

Written by Robert van Boesschoten | Jan 23, 2020 8:00:00 AM

Building business processes in your application can be really simple, or really complex. It depends on what you're trying to build. One rule you should always keep in mind is to keep actions short and agile. Instead of building one long and dragging action, create multiple actions, one initiating the next, and the next.

Result as

In some cases this can be hard, as values in one action aren't always present in the other. Especially when a sub action is requested mid-action. With this new feature, you can return a (resulting) value of the sub action back to the main action.

For example, in my main action I'm creating a shopping list. After that, a sub action is executed, creating a shopping list item. Using the new feature, I can return the newly created item record to my main action.

Sub action

For explanation, it's easier to start with the second half of this. Create the action that will be part of a different action. Make sure you have the 'Background' option is set to false, or else it won't work.

In the 'Result' option, you can choose a variable, any variable within the entire scope of the action. In my case, it's the newly created shoppinglist item.
 
Main action
Now create the main action which is going to include the sub action.

In the sub action event, you'll notice the 'Result as' option. When the sub action is done, the value as result of its process, is then captured through the variable you set for it. In my case var:item.

 

Now I can use this variable in the remainder of my action, for example, use it in an Update event, like this:

 

Try it out for yourself! Depending on the type of resulting value, the variable type may differ.

Bugfix

We also fixed a bug in our expression resolver. In some specific situations, a Belongs to relation wouldn't be resolved in a path.