Difference between revisions of "Workflow call"
Line 2: | Line 2: | ||
{{HelpFiles}} | {{HelpFiles}} | ||
− | + | =Workflow_call= | |
− | + | ==Description== | |
This function will allow you to run a specific workflow or tabulation script, including feeding it with parameters in the process. | This function will allow you to run a specific workflow or tabulation script, including feeding it with parameters in the process. | ||
Line 27: | Line 27: | ||
* It cannot run to a call depth of more than 10 (meaning that it cannot call a workflow that calls a workflow that calls a workflow ... to more than the 10th level) | * It cannot run to a call depth of more than 10 (meaning that it cannot call a workflow that calls a workflow that calls a workflow ... to more than the 10th level) | ||
− | + | ==Syntax== | |
Workflow_call(''workflowResourceId[, array parameters]'') | Workflow_call(''workflowResourceId[, array parameters]'') | ||
− | + | ==Arguments== | |
''workflowResourceId'': number - resource id of workflow | ''workflowResourceId'': number - resource id of workflow | ||
Line 37: | Line 37: | ||
''parameters'': will be passed into the CG Script of the called workflow or tabulation script | ''parameters'': will be passed into the CG Script of the called workflow or tabulation script | ||
− | + | ==Return value== | |
Object: This function returns a number, boolean, string, array, etc. depending on what the called workflow returns. | Object: This function returns a number, boolean, string, array, etc. depending on what the called workflow returns. | ||
− | + | ==Example== | |
'''Main script:''' | '''Main script:''' | ||
− | + | <source lang="javascript"> | |
− | + | array parameters={100}; | |
− | + | number wfId = 12345; | |
− | + | array a = Workflow_call(wfId,parameters); | |
− | + | print(a); | |
− | + | </source> | |
− | |||
− | |||
− | |||
'''Script of worflow with Resource Id = 12345:''' | '''Script of worflow with Resource Id = 12345:''' | ||
− | + | <source lang="javascript"> | |
− | + | array b = Workflow_getParameters(); | |
− | + | b[0] = b[0] + 100; | |
− | + | return b; | |
− | + | </source> | |
− | |||
− | |||
'''The main script will print:''' | '''The main script will print:''' | ||
200 | 200 | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 05:29, 27 May 2020
Workflow_call
Description
This function will allow you to run a specific workflow or tabulation script, including feeding it with parameters in the process.
The function will throw an exception when:
- It is passed an invalid number of parameters
- It is passed invalid data types for any of its parameters
- It is passed empty parameters
- It is passed an invalid workflow resource id
- It is run by a user who does not have at least observer access to the workflow.
This function is useful in regards to:
- Returning values from a workflow that you need in another workflow
- Returning a chart from a tabulation script that you need in another workflow
- Returning the error stacktrace from another workflow
The following limitations apply to this function
- It cannot call a workflow which is set to run in batch mode
- It cannot run to a call depth of more than 10 (meaning that it cannot call a workflow that calls a workflow that calls a workflow ... to more than the 10th level)
Syntax
Workflow_call(workflowResourceId[, array parameters])
Arguments
workflowResourceId: number - resource id of workflow
parameters: will be passed into the CG Script of the called workflow or tabulation script
Return value
Object: This function returns a number, boolean, string, array, etc. depending on what the called workflow returns.
Example
Main script:
array parameters={100};
number wfId = 12345;
array a = Workflow_call(wfId,parameters);
print(a);
Script of worflow with Resource Id = 12345:
array b = Workflow_getParameters();
b[0] = b[0] + 100;
return b;
The main script will print:
200