Skip to content

Initiate

Initiates a new instance by specified arguments.

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

Parameters

( string | Xml ) inputData
    Input data to pass new workflow instance in xml string or xml object.

string process
    Specifies the process of new instance. Can be Name or Id number of process. If not specified current process is used.

InitiateOptions options
    Specifies the options of new instance.

Returns

Instance of initiated workflow's first work item in '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