Variable Resolution
Supported Fields
The following fields in Outputs and lookup functions can take advantage of variable input provided by tuple data.
Variable Syntax
${<field name>} or for built-in functions #{<function name>}
Filesystem
The field "file path" of a Filesystem Output can be made variable. A use case is to output different data to different files.
Gmail, SMTP and EWS
The fields "body" and "subject" of a Gmail Output, SMTP Output, and Microsoft Exchange Output can be made variable. A use case can be flexible and abstract the form of an email from its data.
Email templates are HTML with variable interpolation.
Use:
- ${fieldName} syntax for injecting HTML parts.
- {{fieldName}} syntax for injecting text parts. (In text parts <,>... characters will be rendered as text, not as HTML tags)
<HTML> <Body> <P> <b>User Report Summary for items processed on {{DateSubmitted}}</b> <BR><BR> ${EmailContent}<BR> Thanks<BR> <b>Robin, your Automation Hero assistant</b><BR> <BR> </P> <Body> </HTML>
JDBC
Inserting data into a database via an Output or querying via a lookup can be made variable.
REST
Use variables in a Rest Output to query JSON data from various APIs.
Many fields in the configuration can be templated using tuple variables:
- Base URL
- Request Headers
- Query Parameters
- Cookie Parameters
- Body
Not all of these fields are used at once. As a convenience, these tuple variables are added automatically to the tuple field mapping at the bottom.
The REST connection can use variables as both an Output and as lookup function.
Salesforce
The Salesforce lookup function can be made variable by the usage of tuples as inputs in the SOQL query.
Swagger
Variable resolving is also available for a Swagger Output and the corresponding lookup.
Supported Variables
Tuple Variables
The content, (i.e. the data of tuples) can be used to parametrize a variety of inputs in a Flow. The syntax is always the same. When you have an input tuple field named productId
, the variable will be named ${productId}. Write with the correct capitalization as the processing is case-sensitive. For one input field you can put multiple variables together which resolve independently. One variable can be used even multiple times.
Example: In the path of a Filesystem Output, users can construct a complex file names similar to /${productId}_${customerId}_#{CURRENT_YEAR}.csv
Nested Tuple Variables
Nested tuple variables are supported where a variable is resolved from a tuple field. (Not from field mapping.)
Example: If a tuple (e.g. field name: person), that has a tuple in it ( e.g field name: address), that has the field zipCode. This nested variable is written ${person.address.zipcode} for resolving the zip code.
Placeholder Variables
The following variables can be thought of placeholders. Unlike the previous tuple variables they start with a hash mark.
The following are supported:
- #{SYSTEM.any_system_property_name} - the value (every used environment variable should be listed in hero_platform.conf / variable-resolver / exposed-system-properties; don't expose sensitive variables)
- #{ENVIRONMENT.any_envorinment_variable_name} - the value (every used environment variable should be listed in hero_platform.conf / variable-resolver / exposed-environment-variables; don't expose sensitive variables)
- #{CURRENT_DAY_OF_MONTH} - The first day of the month has value 1 see: https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#DAY_OF_MONTH
- #{CURRENT_MONTH_OF_YEAR} - January = 0 see: https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#MONTH
- #{CURRENT_YEAR} - e.g. 2020
- #{CURRENT_DAY_OF_WEEK} - SUNDAY = 1 https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#DAY_OF_WEEK
- #{TIMESTAMP} - 13 digit timestamp, like 1582853481350 https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#currentTimeMillis()
- #{HOUR_OF_DAY} - 24h clock, i.e. 10 pm = 22 https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#HOUR_OF_DAY
- #{MINUTE} - minute as expected https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#MINUTE
- #{SECOND} - second as expected https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#SECOND
- If a Flow is scheduled to run every hour and use time variables in the resulting file name, the smallest unit of the variable must be less than an hour (e.g. add minutes and seconds too). Scheduled tasks are late or are scheduled on the edge between hours may lead to unexpected results.