Skip to content

Initiate

Initiates a new instance using the specified arguments.

1
myWorkItem.Initiate(inputData: ( string | Xml ), process: string, options: InitiateOptions):WorkItem

Parameters

( string | Xml ) inputData
    The input data to pass to the new workflow instance, in XML string or XML object format.

string process
    Specifies the process of the new instance. Can be the name or ID of the process. If not specified, the current process is used.

InitiateOptions options
    Specifies the options for the new instance.

Returns

The first work item of the initiated workflow in the Created or Waiting state.

Remarks

Basic Usage:

1
2
var formData = '<Root><Name>Lady</Name><Surname>Gaga</Surname></Root>';
var childWorkItem = $WorkItem.Initiate(formData, 'My Process');

Initiate by Task Name:

1
2
3
4
var formData = '<Root><Name>Lady</Name><Surname>Gaga</Surname></Root>';
var childWorkItem = $WorkItem.Initiate(formData, 'My Process', {
      task : 'My Task'
});

Initiate with User and Culture:

1
2
3
4
5
6
7
var formData = '<Root><Name>Lady</Name><Surname>Gaga</Surname></Root>';
var initiator = $Membership.Administrator;
var childWorkItem = $WorkItem.Initiate(formData, 'My Process', {
        task : 'My Task',
        initiator : initiator.id,
        culture: 'tr-TR'
});

Types

InitiateOptions

Culture : string
Culture of new instance. If not specified uses the current instance culture.

Initiator : string
Identity of initiator. If not specified null value used.

Parent : string
Parent work item. If not specified current work item is set as parent.

Task : string
Name or Id of task to be initiated. If not specified, uses the Initiator task if found only one exist, otherwise throws error.

TestMode : boolean
Specifies the initiate in test mode or not. If not specified uses the current instance's test mode state.

Version : string
Version of process to initiate

See Also