Workflow call

From Catglobe Wiki
Revision as of 08:04, 14 December 2011 by Cg pham (talk | contribs)
Jump to: navigation, search



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

Availability

Version 5.8.1