That recipe is confusing to follow, but it seems like you are still creating a new/different log message, such that if I wanted to retrieve the new value later I'd still have to reference the step where it was created. Also, the functionality of "<<" isn't documented anywhere that I can find. Perhaps that would help.
Hi Peter, in the recipe example, the data pill that changes value is the message pill in line 2. It is also used as the email message body in the last step of the recipe in line 9.
In Line 2, Logger was used to create a data pill to contain an array containing an empty string [""].
In Line 9, the email body maps the same data pill from Line 2 output. If you test the recipe, you would receive an email showing an array containing 8 strings (1 empty string and 7 strings) i.e. ["", "1", "2", "3", "4", "5", "6", "7"].
You can see that additional string data has been appended to the same data pill from Line 2 output i.e. [""] transformed into ["", "1", "2", "3", "4", "5", "6", "7"]
The "<<" operator (whitelisted Ruby method on Workato) works to append data on its RHS to the existing data on its LHS.
For example, using formula mode:
Working with arrays:
The Logger in Line 2 is merely used to create a data pill which you can manipulate and use for mapping in a different step down the recipe. The recipe illustrates a different usage for the Logger action. In addition to text/data display, the Logger action can also be used for data manipulation. For instance, if you are working with complex formulas, it is useful to formulate it in logger instead of doing it directly in the app actions so that it is convenient for testing and debugging.
Hope this clarifies.
Thanks, Amanda. It seems like this allows you to append new values to a "Message", acting as a kind of variable, which could be handy in a pinch. Maybe you could keep appending name/value pairs and then searching for how many exist before figuring out which one to use, but that would get really awkward. There still isn't a way to just set a value in the "Message" to a different value, which is what we need for it to act as a useful variable.
What is "RHS" & "LHS"? Where is the list of all whitelisted Ruby methods?
Hi Peter and all,
Please see this recipe example on how you can set up multiple variables for use within a recipe: https://www.workato.com/recipes/642233-workato-variables-set-up-demo
In the recipe, I have set up 2 variables: Variable 1 and Variable 2. The variables need to be set up with dummy values.
This recipe shows you how you can use each of these variables after you have set them up.
1) Step 3 sets a value for Variable 1 using a Log Message action.
2) Step 4 adds a value to Variable 2 using a Log Message action.
Send us a ticket, we will try our best to assist you with your problem
jheuer
User-defined custom variables, for use in recipes
I would like to be able to declare my own variables for use within a recipe. For instance, for a recipe which has an email output, I'd like to declare Subject and Body text variables early in the recipe. Depending on the results of various *IF* statements in the recipe, I'd push various content into these variables as the recipe ran. Then at the end of the recipe, I would compose the email using these "built up" variables.
I can think of lots of other uses of custom variables as well.
8 people like this idea