define
Learn how to set variables in the current scope.
This action sets variables in the current scope, accessible through the this keyword in expressions.
Example
The following template defines a variable and uses it in a subsequent action:
template.json5
{ "$schema": "https://schema.croct.com/json/v1/template.json", "title": "Define example", "description": "Defines a variable and prints it.", "actions": [ { "name": "define", "variables": { "greeting": "Hello, world!" } }, { "name": "print", "semantics": "info", "message": "${this.greeting}" } ]}Variables remain available to all subsequent actions in the template.
Properties
These are the supported properties:
- namestring
The action identifier. Always define for this action.
- variablesobject
A map of variable names to values.
Keys are variable names and values can be literals or expressions.