Skip to content

Initiate

Initiates a new instance using the specified arguments.

1
myWorkItem.Initiate(inputData: ( string | [Xml](./../Xml/index.md) ), process?: string, options?: `Culture` : string

The culture of the new instance. If not specified, the current instance culture is used.

Initiator : string
The identity of the initiator. If not specified, a null value is used.

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

Task : string
The name or ID of the task to initiate. If not specified, the initiator task is used if exactly one exists; otherwise, an error is thrown.

TestMode : boolean
Specifies whether to initiate in test mode. If not specified, the current instance's test mode state is used.

Version : string
The version of the process to initiate.):WorkItem

Parameters

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

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

Culture : string
The culture of the new instance. If not specified, the current instance culture is used.

Initiator : string
The identity of the initiator. If not specified, a null value is used.

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

Task : string
The name or ID of the task to initiate. If not specified, the initiator task is used if exactly one exists; otherwise, an error is thrown.

TestMode : boolean
Specifies whether to initiate in test mode. If not specified, the current instance's test mode state is used.

Version : string
The version of the process to initiate. options optional
    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'
});

See Also