StartWorkflow

You can use this function for Optiva Workflows.

Purpose

The function StartWorkflow can launch a workflow from within another workflow.

Syntax

int StartWorkflow(string actionSet, string objSymbol, string objKey, DateTime startDate, params string[] @params)

Return Value

If the code is successful, a value greater than zero (0) is displayed.

Arguments

Part Description
ActionSetCode Code for the workflow action set.
objSymbol The object type or current object type of the data.
Note: Use empty quotation marks to indicate the current symbol of the workflow.
objKey The object key or the current object key of the data.
Note: Use empty quotation marks to indicate the current object of the workflow.
StartDate The start date for the workflow. Must be a Date/Time type. Empty value indicates current Date/Time.
Param1, param2 The Input tab of the Action Set form has One or more input parameter arguments in the same sequence.

Examples

This example launches the ITEM_APPROVAL workflow from within the FORMULA_APPROVAL workflow. The input parameter is the user who started the workflow.


'Iterate on items.
'Check status of each item. If status values is below a specified value, 
'start workflow to approve the item.
startWorkflow("ITEM_APPROVAL", "ITEM", "00031", Context._STARTUSER)

The next example retrieves the start date of the current project and turns it into a Date/Time type. The due date is calculated for each step of the SHIP_APPROVAL in the Pending Tasks form. To do this, it adds the step duration values from the Action Set form, plus the start date value from this workflow.


Dim startDate as DateTime
startDate = Ctype (ObjProperty("EFF_START_DATE"), DateTime)
startWorkflow("SHIP_APPROVAL", "PROJECT", "00031", startDate)

This example launches an Action Set.


Dim Startdate As Date = Now()
startWorkflow("INPUT PARAM SEQUENCE", "FORMULA", _OBJECTKEY, StartDate, "abc1", "abc2", "abc3")

The name of the workflow is INPUT PARAM SEQUENCE. The action set is comprised of three input codes: PARAM1, PARAM2, PARAM3. The parameter values are abc1, abc2, and abc3. These values are displayed in the Input tab of the Workflows in Progress form. The parameter values can also be defined as variables and inserted in place of abc1, abc2, and abc3.)

Use WipParamGet to retrieve the values for use in the Input Param Sequence workflow.

Example 1:
startWorkflow("ITEM_APPROVAL", "ITEM", "00031");

This command starts the workflow action set named ITEM_APPROVAL for the item with key "00031"

Example 2:
startWorkflow("WF_SPEC_REVIEW", "SPECIFICATION", "Spect\0001", #10/05/2025#);

This command starts the workflow action set named WF_SPEC_REVIEW for the specification object "Spect\0001" to begin on October 5, 2025

Example 3:
StartWorkflow("APPROVE", "", "");
This command starts the workflow action set named APPROVE for the current object on which the workflow is launched.
Note: StartWorkflow does not allow input parameters to be changed by the user. This function creates a pending task for a wizard but does not launch the wizard for the user to view.