Messages
A Message contains all the configuration required to send, receive, and process a request.
Messages are central to the functionality of Unifi. A Message brings together the disparate parts necessary for the configuration required in order to send, receive and process a request.
Message Fields
The Message fields to be configured for the Message record are as follows:
Field | Type | Description |
Type | Choice | The primary purpose of the message. |
Table | Table name | The table this message will be triggered from. This is typically the same as the target table defined on the process. |
Application | Reference | The application containing this record. |
Integration | Reference | The integration this record belongs to. |
Active | Boolean | Set true to use this message for processing. |
Description | String | The description for this message and the requirement it is meeting. |
Message name | String | The message name that is unique for this integration. |
XML Template | String | The template to be compiled when sending a message for an integration that is configured to use XML. Also handy for storing an example message which can be used as a reference on inbound messages. |
Configuration Fields
The Configuration fields to be configured for the Message record are as follows:
Field | Type | Description |
Direction* | Choice | The direction(s) this message is configured to support. |
Response | Reference | The immediate synchronous response to this message. |
Async | Boolean | Turn this option on if you want inbound processing to occur asynchronously or this message is the first of an asynchronous message pair (make sure to set a receipt message). |
Async receipt | Reference | The asynchronous receipt to this message. Leaving this blank will cause the message to be processed asynchronously without sending a receipt. |
Path | URL | A path to append to the URL defined in the connection. Specify a full URL to override the connection. Define inline scripts to reference Stage to Request script variables by wrapping code in braces {}, e.g. /{transaction.message_id}. |
Action method | String | The SOAP Action or the REST Method to use for this message. If this field is empty the SOAP Action will default to the message name and the REST Method will default to POST. |
Send attachments | Boolean | Mark this message as being enabled for sending attachments. |
*Direction choices: Inbound, outbound, or bidirectional.
Trigger Fields
The Trigger fields to be configured for the Message record are as follows:
Field | Type | Description |
Send to self* | Boolean | Enable this option to allow this message to be sent even when the integration it belongs to has caused the update. |
Attachment added* | Boolean | Use this message to immediately send new attachments regardless of the trigger conditions. |
Order | Integer | The order that outbound messages are processed in. |
Use advanced condition | Boolean | Use a script to evaluate the trigger condition for this message. |
Advanced condition* | Script plain | The script that must be met for the message to be processed. Use current to get access to the triggering record. |
Outbound condition | String | The script that must be met for the message to be processed. Use current to get access to the triggering record. |
Outbound condition | Conditions | The condition that the ServiceNow record must meet to trigger this message being processed. |
*Send to self:
By default, if an integration updates a target record it will not trigger messages to be sent back to itself, preventing feedback loops.
*Advanced condition:
This field is made visible when the 'Use advanced condition' field is set to true.
*Attachment added:
This field is made visible when the 'Send attachments' field is set to true.
Bond Fields
The Bond fields to be configured for the Message record are as follows:
Field | Type | Description |
Bond ownership* | String | Determine if the sender should own the bond or not in order for this message to be processed? Use ‘Ignore’ to process regardless of the owner flag. |
Bond condition type | String | The type of conditional check made on the bond. None: no checks are made. State: checks against the state are made using the conditional checkboxes. Scripted: the ‘Bond condition’ script is used. |
Bond reference method | String | Method of searching for and validating an existing bond for incoming messages. Internal: lookup using the internal reference only. External: lookup using the external reference only. Both: lookup using both the internal and external references. |
Bond new | Boolean | Process this message when a new bond is required. |
Bond pending | Boolean | Process this message when the bond state is Pending. |
Bond open | Boolean | Process this message when the bond state is Open. |
Bond suspended | Boolean | Process this message when the bond state is Suspended (internal suspend). |
Bond vendor suspended | Boolean | Process this message when the bond state is Vendor suspended (external suspend). |
*Bond ownership choices: Ignore, Must own, Must not own.
Scripts Fields
The Scripts fields to be configured for the Message record are as follows:
Field | Type | Description |
Reference lookup script | Script plain | The script containing functions for extracting internal and external references from the request payload. |
Extract attachments | Boolean | Use the Extract attachments script to extract attachments from the inbound payload and prevent attachment data from being stored in the Request payload field. |
Extract attachments script* | Script plain | The script used to extract attachment data from a request payload. Used to prevent writing attachment data to the request payload field (full payload can be attached using integration ‘Attach payloads’ option). |
*Extract attachments script
This field is made visible when the Extract attachments
box is checked. The script must always return a string and if an object is used it needs to be JSON encoded (i.e. JSON.stringify()
). The following is an example:
CDATA
It is possible to use CDATA within an XML message, but because of the way ServiceNow handles XML it can be a little bit tricky. When ServiceNow see’s the CDATA tag, it actually processes it and the tag ends up being removed in the final. We need to use a little trick allow us to actually get the CDATA in the final result.
Last updated