Use substitution variables to dynamically insert values in ACLI scripts
Substitution variables let you dynamically insert useful values, like timestamps or user information, into ACLI actions. This feature is especially powerful in clients such as Jira, where you can customize issue creation or updates based on live data. Other clients also support substitution variables, though in a more limited way, using the same general approach.
Syntax
To reference a substitution variable, use the following syntax:
%<variable_name>%
Example:
%now%
Substitution variables vs. variable replacements
Substitution variables and variable replacements are not the same. They use different syntax and serve different purposes. Be careful not to confuse them.
Common substitution variables
Variable | Description | Notes |
|---|---|---|
| Inserts the current date and time. | Uses the server's time if the client accesses a server; otherwise, uses the client’s local time. The value is calculated once per session. |
| Inserts the base URL of the connected application. | Returns blank if the client does not access a server. |
| Inserts the current user's ID. | Returns blank if the client does not define a user for server access. |
Function-based substitution variables
Functions let you compute values dynamically and use them as substitution variables. Function names follow this format:
%function_<function_name>(<parameters>)%
Supported functions
list(number, number)compare(number, number)compare(text, text)lowercase(text)uppercase(text)
Function examples
Function | Result | Description |
|---|---|---|
|
| Produces a comma-separated list of numbers. |
|
| Returns -1, 0, or 1 to indicate less than, equal, or greater than. |
|
|
|
|
|
|
|
| Empty comparison returns 0. |
|
| Compares the lowercase version of |
|
| Converts the string to lowercase. |
|
| Converts the string to uppercase. |
Format date substitution variables
You can specify the format for date-based substitution variables using a SimpleDateFormat string. Place the format inside parentheses after the variable name.
Example:
%now(yyyy-MM-dd)%
Result:
2019-11-08
This is useful when the default format doesn’t match your needs.