Skip to content

Trigger

Triggers the specified event with input data and returns the IDs of triggered listener work items.

1
myWorkItem.Trigger(eventName: string, inputData: ( string | Xml )):Array<string>

Parameters

string eventName
    The name of the event to trigger. Multiple events can be specified with a ";" delimiter.

( string | Xml ) inputData
    The input data to be sent to listeners.

Returns

An array of IDs for the triggered listener work items.

Remarks

If the input data is not an instance of Xml or a string, an exception is thrown.
If no listeners are triggered, an empty array is returned.

Example

1
2
3
4
5
var workItems = $WorkItem.Trigger('Customer.Created', $Xml.SelectSingle('Customer'));

if (workItems.length) {
   var workItem = workItems[0];
}