Message Fields

  • Navigate to [ws] Unifi > Configuration > Messages > New.

  • The Message fields to be configured for the CreateIncidentResponse Message are as follows:

# Field Description Value
1 Type The primary purpose of the message. ‘Response’
2 Integration The integration the record belongs to. < lookup: Integration ‘Name’ >
3 Active Set true to use this message for processing. < checked >
4 Message name The message name that is unique for this integration. ‘CreateIncidentResponse’

The top section of your CreateIncidentResponse Message record should look like this:

CreateIncidentResponse Fields

‘Configuration’ Tab Fields

  • Click on the ‘Configuration’ tab and configure the fields as follows:
# Field Description Value
1 Direction The direction(s) this message is configured to support. (Choices: Inbound, Outbound, Bidirectional) ‘Inbound’

Your ‘Configuration’ tab should look like this:

CreateIncidentResponse Configuration

‘Scripts’ Tab Fields

  • All of the values in the ‘Scripts’ tab fields are to be left as-is.

  • ‘Save’ the record .

  • Configure the following Message Scripts by clicking on ‘New’ in the related list:

Message Scripts

Message Scripts

Message Scripts are where the request processing and data mapping occurs. They are also the place where Bond state & ownership are set.

Payload to Stage (Inbound)

Data coming in is going to be translated (moved as-is) from the Request to the Stage.

  • The Message Script fields to be configured are as follows:
# Field Description Value
1 Type The type of message script. ‘Payload to Stage (Inbound)’
2 Script* The script to run. Replace the ’// Add your code here’ with the following: stage.external_reference = payload.result.sys_id;

*Script:

The code in the script field should look like this:

(function processPayloadToStage(payload, stage, transaction, message) {

	stage.external_reference = payload.result.sys_id;

})(payload, stage, transaction, message);

Your Payload to Stage Message Script record should look like this:

CreateIncidentResponse Payload to Stage

  • ‘Submit’ the record.

  • Configure the second Message Script by again clicking on ‘New’ in the related list:

_Stage to Target (Inbound)_

Data coming in is going to be transformed (moved and changed) from the Stage to the target.

  • The Message Script fields to be configured are as follows:
# Field Description Value
1 Type The type of message script. ‘Stage to Target (Inbound)’
2 Script* The script to run. Replace the ’// Add your code here’ with the following: bond.setOpen(); bond.setValue(‘external_reference’, stage.external_reference);

*Script:

The code in the script field should look like this:

(function processStageToTarget(target, stage, transaction, message, bond) {

	bond.setOpen();
	bond.setValue('external_reference', stage.external_reference);

})(target, stage, transaction, message, bond);

Your Stage to Target Message Script record should look like this:

CreateIncidentResponse Stage to Target

  • ‘Submit’ the Message Script.

  • ‘Update’ the CreateIncidentResponse Message record.

We are now ready to configure our CreateIncident Message.