Event Subscriber Scripts as XML Definitions
Event Subscriber scripts let you run follow-up processing asynchronously after supported events occur.
Event Subscriber scripts are implemented as part of SuiteCloud projects created using the SuiteCloud Development Framework (SDF). In SDF, an Event Subscriber script is defined by an eventsubscriber SDF custom object.
For information about developing Event Subscriber scripts, see SuiteScript 2.1 Event Subscriber Script Type.
Take note of the following guidelines when creating the XML definition file for an Event Subscriber SDF object:
-
Each Event Subscriber script in the SuiteCloud project must have a corresponding
eventsubscriberobject definition XML file in the Objects folder. -
The value of the
scriptidattribute must match the name of the Event Subscriber object definition XML file. -
The
scriptfilepathfield must reference the Event Subscriber script file. -
The subscription criteria in the object definition determine which supported events trigger the script.
For information about the attributes and fields in an eventsubscriber SDF custom object, see eventsubscriber.
Example of an Event Subscriber Script Object
The following example defines an Event Subscriber object that references the eventSubscriber.js script file and subscribes to create events for sales order records.
The object definition XML file is named custevsub_salesorder.xml.
<eventsubscriber scriptid="custevsub_salesorder">
<scriptfilepath>[/SuiteScripts/eventSubscriber.js]</scriptfilepath>
<criteria>
<criterion>
<domain>RECORD</domain>
<type>CREATED</type>
<parameters>
<parameter>
<name>RECORDTYPE</name>
<operator>EQ</operator>
<value>SALESORDER</value>
</parameter>
</parameters>
</criterion>
</criteria>
</eventsubscriber>
Related Topics
- Scripting
- User Event Scripts as XML Definitions
- Scheduled Scripts as XML Definitions
- SDF Installation Scripts as XML Definitions
- Map/Reduce Script Objects as XML Definitions
- Portlet Scripts as XML Definitions
- Client Scripts as XML Definitions
- Mass Update Scripts as XML Definitions
- Suitelet Scripts as XML Definitions
- RESTlet Scripts as XML Definitions
- Custom Tool Scripts as XML Definitions