Hi jheuer. Thank you for reaching out. I will talk to my collleague from the Technical Team to find out more about the declaration of custom variables in a recipe.
Meanwhile, the use case that you have described can be achieved using the formula mode in Workato. In the Subject or Message field in the Send email action (under the Workato Email App), you can use the formula mode to combine data pills from the outputs of previous steps. You can also process some data modification to modify the data inputs to suit the content that you would like to include in the email. Below is a screenshot of an example:
You can find out more about the formula mode here: https://support.workato.com/support/solutions/articles/1000142742-what-is-formula-mode-and-how-to-use-it-
Hope this helps!
For emails sending through our email adaptor, we are using a custom service for it.
Internally, we use Gmail for other @workato.com email aliases.
Use Case: Store a record ID that may have been gathered from one or more actions. For instance get an ID from one action, if it is blank, go through a bunch of steps and create a record and use that one's ID instead later in the recipe. It would be much easier to reference the record's ID if I could just put it in a variable for later use instead of trying to figure out which step in the recipe retrieved the ID that I want to use.
Hey Peter! Thanks for that feedback. I agree that variables within a recipe would be a pretty useful feature :)
In the meantime, there is a workaround that I would suggest to this:
In lieu of custom variables, I often use our Log message action. It's available under the Utilities app (screenshot below).
Once the Message has been set, you can use that as a "kinda sorta" variable.
Hi Team Workato, where is this feature on your current roadmap? When I signed up you said it was there...
@Kyle Tan appreciate the suggestion for the variable hack, though I need multiple variables/recipe.
Use case: I would like combine the contents of various items and output it into another system. For example, I wish to loop over various test results, wrapping each result in TR/TD tags, so that I can then send the combined results to a new destination (email/webpage).
An internal string variable would be really helpful for doing this.
Hello,
We may not have a feature yet specifically for creating a custom variable, but we do have the list app that works similarly. With the "Append Item to List" you can create a field that will function as this custom variable. Does this work for your needs? Let us know what isn't covered so our product team can look into this.
I also have a use case that would benefit from the functionality suggested. All of the work arounds suggested thus far (formulas, logging a message, and appending to a list) all fail to address one major point - the ability to set the value of a custom variable in more than one action.
All of the use cases mentioned, including my own, have either complex conditions or iterative actions that require multiple steps in order to get to the desired output. We're looking for an internal variable we can use to store this value. Logs and Lists aren't able to accomplish this because they can only be defined in the step they're created in. They can't be edited again in another action. Formulas in the output step also can't address this if we want to access information within a repeat action.
I'm hoping this feature finds it's way to the road map!
Patricia - the list is a useful tool but I've found it to be somewhat limiting when you jump from loop to loop. You can't use the same List from your first loop in your second loop, and you have to define a new one.
A "variable" that you could set should act like a callable recipe but with no actions. That might be a possible intermediate solution. Your input and response schema would just be the same thing. The only action being the response which maps all the fields over.
You can actually add data to an existing Logger message using the operator <<
Would this help?
See example:
Recipe steps corresponding to above screenshot:
Step 1 Log message to create an empty array
Step 3 Log message to append a number to array in Step 1
Step 4 Log message to append array of contact IDs from search result to array in Step 1
Step 5 Log message to convert array in Step 1 to string
Note: Message pill is from Step 1 output
---
Further, while the Append item to list action creates a new list with each use of the action, you can take steps to combine the created lists later, assuming you are expecting to use a list data pill for a source list field or a repeat action. To date, the ways to combine lists / create a list from a string or array data type have been explored here: [1] / [2]
Useful formulas for array handling: http://docs.workato.com/formulas/array-list-formulas.html
The idea behind a variable is that it can change. You can not change the "variable" within a logged message. You'd have to log a new message. Then you'd have to use the pill from the second message instead of your first.
Not being able to reassign the value from the first logged message is the piece we're wanting.
If we had a way to set a value in an array, or add a new item, that would work, but all the Workato operators are only for reading from the array.
Chase and Peter, apologies if the example provided before is unclear.
This is possible with the << operator in formula mode. You may wish to check out the recipe mentioned in the answer to this forum topic: https://support.workato.com/discussions/topics/1000086351
If you wish to change the value or the message pill entirely, you can use message.clear << "abc".
If you wish to add a value as an additional element to an array in the message pill, you can use message << "abc"
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