- 15 Mar 2024
- 4 Minutes to read
- Contributors
- Print
- DarkLight
- PDF
Parameters
- Updated on 15 Mar 2024
- 4 Minutes to read
- Contributors
- Print
- DarkLight
- PDF
Parameters can be of the following types:
For more information about how to get task parameters from a State Diagram, go to Getting task parameters from State Diagram.
Task parameters
Task parameters can be Global and Local.
Global parameters
You can use the Global parameters in the Condition, Set Parameters, API Call, Queue, Copy Task, Call a Process, Reply to Process, Modify Task, and Sum nodes.
The Global parameters are the parameters defined by the system. You can use them, but you can’t customize them. In the table below, you can see the list of Global parameters, their types, and description.
Parameter name | Data type | Description |
---|---|---|
root.prev_node_id | string | Previous node ID. |
root.user_id | number | ID of the user, who created or changed the task last. |
root.end_time | number | Dynamic value of the start timer (for example, the timer that has to wake you up at 8 a.m.). |
root.change_time | number | Task change time in the Unix Time format. |
root.create_time | number | Task creation time in the Unix Time format. |
root.task_id | string | Task ID generated by the Process. |
root.node_id | string | Node ID. |
root.conv_id | number | Process ID. |
root.ref | string | Task reference. |
In the video below, you can see how to access the Global parameters from the node details panel.
Local parameters
The Local parameters are the parameters that you can add manually to your Process or State Diagram.
For more information on how to add Local parameters, go to Set task parameters.
In the video below, you can see how to access the Local parameters from the node details panel.
Getting task parameters from State Diagram
Precondition:
- The State Diagram must exist.
- Tasks must be stored in the State Diagram.
- You must have access to the State Diagram.
Corezoid tasks are stored in the JSON format, meaning that they are represented as objects.
You can use a State Diagram as a data storage from where you can get a single or multiple parameters by using the following template for your request:
Where:
conv: Is a constant keyword used to get data from a State Diagram.
Methods to define the State Diagram can be:
- variable: Is data that varies depending on the entity that you refer to. For example, {{Process_ID}} that stores a different ID number for each Process.
- static ID: Is an exact data, for example, a Process ID.
- @alias-name: Is the name of the alias you are calling.
.ref: Is a constant keyword used to get data from a task with a corresponding reference number.
Data type can be:
- variable: Is data that varies depending on the entity that you refer to. For example, {{Reference_ID}} that stores a different ID number for each reference.
- static ID: Is an exact data, for example, a reference ID.
(Optional) .parameter: Is a specific parameter name that you are retrieving.
When working with a State Diagram, you can get:
The whole task by using the following parameter request:
{{conv[{{Process_ID}}].ref[{{REF}}]}}
Where:
- Process_ID is the Process ID of the State Diagram (can be found by clicking the Start node in the Edit mode).
- REF is the reference of the task.
For example: The following statement will return all the task parameters of the 12345 task from the Customers State Diagram:
{{conv[customers].ref[12345]}}
A single task parameter by using the following static parameter request:
{{conv[{{Process_ID}}].ref[{{REF}}].parameter}}
Where:
- Process_ID is the Process ID of the State Diagram (can be found by clicking the Start node in the Edit mode).
- REF is the reference of the task.
- parameter is the parameter you want to retrieve.
For example: The following statement will return the amount_owed task parameter of the 12345 task stored in the Customers State Diagram:
{{conv[customers].ref[12345].amount_owed}}
Corezoid will try to automatically match the type if the accessed value type doesn't match the one specified. To avoid potential errors, specify the correct parameter type of the value you are trying to get.
A single task parameter by using a dynamic parameter request, for example:
{{conv[{{my_proccess_name}}].ref[{{my_task_reference}}].amount_owed}}
Where:
- Process_ID and REF are names of variables that store their values in double curly braces and not the exact values.
- parameter is a static value.
A single task parameter by using their alias, for example:
{{conv[@alias-name].ref[{{REF}}]}}
Node parameters
Callback URL
With the Callback URL function, you can get a Callback URL in the Waiting for Callback node dynamically.
For example:
// Returns Corezoid or Mandrill CallbackURL by {{node_id}}
{{node[{{node_id}}].public_callback_corezoid}}
{{node[{{node_id}}].public_callback_mandrill}}
// Returns Corezoid or Mandrill CallbackURL by {{node_id}} from {{conv_id}} process
{{conv[{{conv_id}}].node[{{node_id}}].public_callback_corezoid}}
{{conv[{{conv_id}}].node[{{node_id}}].public_callback_mandrill}}
Count
The Count function returns the amount of tasks in a node with the specified ID. For example:
// Node ID = 561a272782ba961374d44178
{{node[561a272782ba961374d44178].count}}
// Returns amount of tasks in the node specified by the parameter {{node_id}}
{{node[{{node_id}}].count}}
// Returns amount of tasks in the node specified by the parameter {{node_id}} from {{conv_id}} process
{{conv[{{conv_id}}].node[{{node_id}}].count}}
Sum
The Sum function returns the sum value for the selected task parameter. For example:
// Node ID = 561a272782ba961374d44178
{{node[561a272782ba961374d44178].SumID}}
// Returns amount by SumID parameter from node {{node_id}}
{{node[{{node_id}}].SumID}}
// Retuns amount by SumID parameter from {{node_id}} from {{conv_id}} process
{{conv[{{conv_id}}].node[{{node_id}}].SumID}}