Bind Process Variables
Bind variables from a workflow or variables from a process to script variables when you run bots.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Enter the name of the variables from the process or workflow and the corresponding script variable to bind.
If the workflow
parameter is specified, the mapped variables are bound to a workflow. If it is left empty, the variables
are bound to a process. If the process is unavailable, the runtime throws an error.
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
bindProcessVariables --workflow(Workflow) --mappings(String)
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Workflow | workflow |
Optional |
Workflow |
Variable of the type workflow from which the variables are mapped. |
Mappings | mappings |
Required |
Text |
Variables that are mapped from the Workflow file or Orchestration process. For more information, see the mappings parameter options. |
mappings
parameter options
The following table displays the options available for the mappings
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Parameter | mappings |
Enter the name of the variable in the workflow file or orchestrator process. The name must match exactly how it is spelled in the source. |
Value | mappings |
Enter the variable that receives the value of the mapped variable. This is an IBM RPA Studio variable. |
Example
An orchestrator process is simulated then process variables are bound to the script using the Bind Process Variables command to save changes to the variable.
defVar --name queueName --type String --value "Simulated queue"
defVar --name queueStructure --type String --value "Simulated queue structure"
defVar --name variableContent --type String --value "IBM Robotic Process Automation Simulate Orchestrator"
defVar --name variableReceives --type String
defVar --name successGet --type Boolean
mockProcess --queuename "${queueName}" --body "${queueStructure}Simulated queue structure."
mockProcessVariable --name variableName --type "Text" --value "${variableContent}"
endMockProcess
currentQueueMessage queueName=queuename queueStructure=body successGet=success
bindProcessVariables --mappings "variableName=${variableReceives}"
logMessage --message "\r\nProcess variable: ${variableContent}\r\nScript variable: ${variableReceives}" --type "Info"
// Result:
// Process variable: IBM Robotic Process Automation Simulate Orchestrator
// Script variable: IBM Robotic Process Automation Simulate Orchestrator
Limitations
- Changes to variable values that occur before this command are not applied. You must change variable values only after binding them.