Skip to main content
Version: 1.28 (Current)

Create/Update Tokens

Audience: Low-code Engineers

Skill Prerequisites: Actions, Tokens

Creates tokens, or changes the value of existing ones, in the current execution. Each row has a Token Name and a Token Value. The value is an expression that can mix text and tokens, and it's evaluated when the action runs. Actions that run afterwards can use the result, for example [FullName].

The value can be evaluated more than once. That's useful when a token contains text with more tokens inside, such as a stored email template.

Typical Use Cases​

  • Set a token to a fixed value, or to an empty string, before other actions use it
  • Combine tokens into a new one, for example [FirstName] [LastName] into [FullName]
  • Calculate a value with a token such as [DoMath:Eval(...)] and keep the result
  • Replace the tokens inside a template stored in the database or in another token
  • Change a value that earlier actions set, for example to clean up or reformat it
  • Create numbered tokens in a loop, such as Customer1, Customer2, with Tokenize Token Names

Don't use it to​

  • Keep data for a later request, such as the next submit. Tokens only exist for the current execution. Save the data in a database, hidden field or session instead.
  • Evaluate text that users typed with Number of Recursions above 1. Tokens can read data users shouldn't see. See Considerations.
  • Split JSON into separate tokens. Use Parse JSON into Tokens instead.
Action NameDescription
Execute Token (Obsolete)Older action that evaluates one expression once. Replaced by this action.
Inject Data (Obsolete)Older action that sets tokens without recursion. Replaced by this action.
Run SQL QueryRuns SQL and saves the result in tokens.
Parse JSON into TokensTurns the properties of a JSON object into tokens.
Context to JSON ObjectBuilds a JSON object from tokens.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
TokensA list of rows, each with a Token Name and a Token Value. The value is the expression to evaluate, for example [FirstName] [LastName]. Rows run top to bottom, and you can reorder them. Rows with an empty name are skipped.Yes (Token Value)empty listYes (Token Name of each row)
Tokenize Token NamesWhen checked, tokens in the Token Name are also replaced. For example, if [Index] is 1, the name Customer[Index] sets [Customer1].NofalseNo
Number of RecursionsHow many times the tokens in each Token Value are replaced. Use 1 for normal values. Use 2 or more when the value contains tokens whose own values contain tokens. 0, an empty value or text that isn't a whole number means the value is saved as typed, with no tokens replaced.Yes1Yes

Output Parameters Reference​

ParameterDescription
Tokens (Token Name)Each row's Token Name becomes a token that holds the evaluated Token Value. Use it as [TokenName] in later actions.

How recursion works​

Each pass replaces the tokens found in the value. With Number of Recursions set to 1, tokens are replaced once. If a token's value contains more tokens, those stay as text.

For example, a token [EmailTemplate] holds the text Hi [User:FirstName], your order is ready.

Number of RecursionsToken ValueResult
1[EmailTemplate]Hi [User:FirstName], your order is ready.
2[EmailTemplate]Hi John, your order is ready.

Use the lowest number that gives you the result you need. Extra passes don't change the result once no tokens are left, but each pass takes time. 2 or 3 is enough for almost every case.

Considerations​

  • Rows run in order. A row can use a token set by a row above it. If two rows have the same name, the lower row wins.
  • Existing tokens are overwritten. If a token with the same name already exists, its value is replaced. Token names aren't case-sensitive, so total and Total are the same token.
  • Type the name without brackets. Enter FullName, not [FullName]. The name is used exactly as typed, so avoid spaces too.
  • The result is text. A calculation or JSON result is saved as a string.
  • Tokens only last for the current execution. They're available to the actions that run after this one, but not in the next request.
  • Always include RecursionCount in imported JSON. If it's missing, the value is saved as typed and no tokens are replaced.
  • Security. Only use Number of Recursions above 1 on content your application controls. If a value contains text that users typed, the second pass evaluates any tokens in it. For example, a user could enter [User:Email(UserId=1)] and get another user's email address.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Build a full name and calculate a total​

This action sets [FullName] from two tokens, then calculates [Total] from [Price] and [Quantity].

{
"Title": "Create/Update Tokens",
"ActionType": "ApplyTokens",
"Description": "Set the full name and the order total",
"Parameters": {
"Tokens": [
{
"name": "FullName",
"value": "[FirstName] [LastName]"
},
{
"name": "Total",
"value": "[DoMath:Eval(expression=[Price]*[Quantity])]"
}
],
"TokenizeTokenNames": false,
"RecursionCount": "1"
}
}

2. Replace the tokens inside a template​

The first row copies the template text into [EmailTemplate], as it would come from a database. The second action evaluates it twice, so the [User:FirstName] token inside the template is also replaced. [EmailBody] then contains, for example, Hi John, your order is ready.

{
"Title": "Execute Actions",
"ActionType": "ExecuteActions",
"Description": "Apply the tokens inside a template",
"Parameters": {
"ActionList": [
{
"Title": "Create/Update Tokens",
"ActionType": "ApplyTokens",
"Description": "Load the template",
"Parameters": {
"Tokens": [
{
"name": "EmailTemplate",
"value": "Hi [User:FirstName], your order is ready."
}
],
"RecursionCount": "0"
}
},
{
"Title": "Create/Update Tokens",
"ActionType": "ApplyTokens",
"Description": "Replace the tokens in the template",
"Parameters": {
"Tokens": [
{
"name": "EmailBody",
"value": "[EmailTemplate]"
}
],
"RecursionCount": "2"
}
}
]
}
}

3. Create a numbered token​

With Tokenize Token Names checked, the name Customer[Index] becomes Customer1 when [Index] is 1. This is useful inside a loop such as Repeat.

{
"Title": "Create/Update Tokens",
"ActionType": "ApplyTokens",
"Description": "Save the customer name under a numbered token",
"Parameters": {
"Tokens": [
{
"name": "Customer[Index]",
"value": "[CustomerName]"
}
],
"TokenizeTokenNames": true,
"RecursionCount": "1"
}
}

Revised 09/26/2026