Skip to content

WorkItem.Initiate

Overview

WorkItem WorkItem.Initiate ( inputData, [ process ], [ options ] )
Initiates a new instance by specified arguments.

Arguments

string | XmlNode inputData Specifies the input data of new instance. Can be specified as xml string or XmlNode.

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

object options Specifies the options of new instance.

Can be contain any of following properties.

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

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

Identity | string initiator Identity of initiator. If not specified null value used.

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

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

Remarks

Examples

Basic Usage

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

Initiate by Task Name

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

Initiate with User

var formData = '<Root><Name>Lady</Name><Surname>Gaga</Surname>';
var initiator = $Membership.Administrator;
var childWorkItem = $WorkItem.Initiate(formData, 'My Process', {
        task : 'My Task',
        initiator : initiator.id
});

See Also