For each of our Scenarios we will need to configure the relevant Messages & Fields. This scenario will need to be tested before moving on to the next.
The Messages we shall be configuring for the Update Scenario are:
Response
UpdateIncident
We will define which Field records require configuring for each of those Messages at the appropriate time.
The scenario will need to be successfully tested before we can say it is complete.
We shall look in detail at each of the Messages and their respective Fields in turn over the next few pages, before moving on to Test.
The Response Message is the immediate synchronous response that is sent to acknowledge the successful transport of another Message.
As previous, after clicking the 'Messages' icon, you will see the following screen (note: both the previously configured messages are now visible in the list):
1) Click New.
The fields to be configured for the Response New Message modal are as follows:
Your Response New Message modal should look like this:
5) Click Submit.
You will be redirected to the Messages page. You need not configure the Response Message any further.
Now it's time to move on and configure the UpdateIncident Message.
#
Field
Description
Value
2
Message name
The message name that is unique for this integration.
'Response'
3
Type
The primary purpose of the message.
'Response'
4
Direction
The direction(s) this message is configured to support. (Choices: Inbound, Outbound, Bidirectional)
'Inbound'
We will utilise the Field & Field Map records to configure the Message Scripts for the UpdateIncident Message.
The 'incident.short_desccription' (Integration level) Field record should already be in place (i.e. with Active set to false). Creating the Message level counterpart is now easier than ever.
From the UpdateIncident page, navigate to Message > Fields.
1) Find the incident.short_description (Integration level) Field & set Active to true.
The 'Build Integration' button becomes visible in the banner and the empty circle icon next to the Field name turns green & contains a green 'check' (to indicate that Message level configuration exists for this Field).
By simply setting the Active flag to true on the Integration level Field record listed on the Message, Unifi has automatically created the Message level counterpart. The Integration level record still exists (and can be seen when you click on the 'Fields' icon to navigate to the Fields page), but is no longer visible in the list view on the Message because the Message level record has been created.)
Hints & Tips: Unifi automatically creates Integration level Fields when we first create the Message level equivalent records; those Integration level Fields are visible on the Fields list of the Messages we subsequently create. Therefore, if a Field is required for multiple Messages, create it once for the first Message and then simply set active to true for its Integration level counterpart from the Fields list of each of the relevant Messages that Field is required on.
We will now configure Field records for two other Incident record field elements.
The table below lists the Incident fields above and the relevant Field Maps required to configure each Field record.
We have chosen String type here because we are integrating with the table API. This will return the contents of those fields as a string value. If we were integrating Unifi to Unifi we may use a Journal field type which would return an array of comments objects with "text", "created_on", "created_by" & "published" elements.
*Field map: Values may vary (dependent on your configuration of the copies). Choose the copy Field Maps you created earlier.
Because the incident.comments Field record is the same 'type' (IS - String) & the majority of the settings are the same as the previously configured Field, it will be quicker to copy the incident.short_description Field & make a few minor changes.
2) Click the ellipsis next to the incident.short_description Field record & click Copy.
The fields to edit for the Copy Field modal are as follows:
*This field is automatically populated.
Your Copy Field modal should look like this:
5) Click Copy.
You will be redirected to the Details page of the newly created incident.comments Field record.
It will again be quicker to copy the previously configured incident.comments Field & make a few minor changes.
To quickly navigate back to the UpdateIncident Message, click the 'Preview' icon next to the Message field on the Details page of newly created incident.comments Field record.
Navigate to Message > Fields.
6) Click the ellipsis next to the incident.comments Field record & click Copy.
The fields to edit for the Copy Field modal are as follows:
*This field is automatically populated.
Your Copy Field modal should look like this:
9) Click Copy.
You will be redirected to the Details page of newly created incident.work_notes Field record.
Now that we’ve configured the Field records for the UpdateIncident message, we are ready to build our message scripts.
Navigate to the UpdateIncident Message, then navigate to Message > Fields.
The following Field records should now be in place for your UpdateIncident messsage:
10) Click on Build Message.
You will see the 'Message build successful' Info Message.
11) Navigate to Advanced > Script Editor to view the auto-generated code.
Your Script Editor fields should look like this:
The newly auto-generated code will appear between a Begin & End Comment immediately prior to any code that may already be there (pre-existing code will be retained).
We will now examine our new, auto-generated Message Scripts.
Source to Stage:
Stage to Request:
We are now ready to Test the UpdateIncident Message.
The UpdateIncident Message is an update type message that sends updates to the bonded record.
After submitting the 'Response' Message, you were redirected to the Messages page (note: the three previously configured messages are now visible in the list):
1) Click New.
The fields to be configured for the UpdateIncident New Message modal are as follows:
Your UpdateIncident New Message modal should look like this:
5) Submit and view to further configure the Message.
Navigate to Message > Response.
The Response fields to be configured are as follows:
*This field is automatically defaulted to true.
Your Response form should look like this:
8) Navigate to Message > Bond.
The Bond fields to be configured are as follows:
*These fields are automatically populated.
Your Bond form should look like this:
10) Navigate to Outbound > Trigger.
The Outbound Trigger fields to be configured (as required)* are as follows:
*Outbound condition (as required):
It is not necessary for you to enter a condition. The value given is an example. You may create any condition (or not) to align with your business process requirements.
Your Outbound Trigger form should look like this:
12) Navigate to Outbound > Settings.
The Outbound Settings fields to be configured are as follows:
*Path
Only include the /table/incident
element of this value if you have used the truncated Endpoint URL in the Connection. If you have used the full Endpoint URL, do not include that element of it here.
Your Outbound Settings form should look like this:
15) Click Save.
We are now ready to configure the Fields for our UpdateIncident Message.
We will test our UpdateIncident Message.
Navigate to < Your Incident > created in the previous test.
Your Incident record should look like this:
1) Enter < Your Work notes > in the 'Work notes' field.
2) Click Post.
The following activities are added to the 'Notes' tab (confirming sending the UpdateIncident Message to your integration):
Click through to the Bond record from the related list on the Incident.
Your Bond record should have been updated as follows:
3) Transaction:
Message: 'Updateincident'
Direction: 'Outbound'
Transaction state: 'Complete' (The data has been successfully transported)
Process state: 'Accepted' (The transaction was accepted as within the scope of the business logic that's in place)
Click through to the Transaction record from the related list on the Bond.
Your Transaction record should look like this:
4) Transaction details:
Table: 'Incident [incident]'
Document: < Your Incident >
Integration: < Your Integration >
Connection: < Your Connection >
Bond: < Your Bond >
Message: 'UpdateIncident'
Direction: 'Outbound'
Transaction state: 'Complete' (The data has been successfully transported)
Process state: 'Accepted' (The transaction was accepted as within the scope of the business logic that's in place)
5) Errors:
Error: (If there was a transactional error the Transaction state would show as 'Error' and the details would be captured here).
Process error: (If there was a process error the Process state would show as 'Rejected' and the details would be captured here)
6) Stage:
Direction: 'Outbound'
Message: 'UpdateIncident'
Internal reference: < ServiceNow ticket reference > (Same as 'Document')
External reference: < External system's ticket reference >
Click through to the Stage record from the related list on the Transaction.
Check the values in the fields match what you expect.
Your Stage record should look like this:
7) Stage details:
Direction: 'Outbound'
External reference: < External system's ticket reference >
Internal reference: < ServiceNow ticket reference >
Snapshot: < Snapshot record reference >
Message: 'UpdateIncident'
Transaction: < Your Transaction >
Integration: < Your Integration >
8) Mapped Staged Data fields:
Work notes: < Your Work note >
Click through to the HTTP Request record from the related list on the Transaction.
Your HTTP Request record should look like this:
9) HTTP Request details:
Integration: < Your Integration >
Connection: < Your Connection >
Transaction: < Your Transaction >
Message: 'UpdateIncident'
Direction: 'Outbound'
Request state: 'OK' (There are no errors with the HTTP Request.)
Attempt number: < Number of HTTP Request attempts > (Failed requests are retried up to the maximum attempts number as configured on the Integration.)
Endpoint URL: < The external system’s access URL >
Action Method: 'PUT'
Request headers: < The header of the request being sent >
Request payload: < The payload of the request being sent >
10) Response details:
Status code: '200'
Response headers: < The header of the response being received >
Response payload: < The payload of the response being received >
Navigate to the corresponding Incident in the external system.
Check the values in the fields match those you noted when you saved the Incident in the internal system.
Your external system's Incident record should look like this (depending on the system you're integrating with, your record may look different; the important matter is that the values match):
11) Activities: < Your Work note > (added by < your.external.system.user >)
Repeat the steps above - this time placing a check in the 'Additional comments (Customer visible)' checkbox.
What do you expect to happen?
Incident Field
Field Map
comments
'PI - String'*
work_notes
'PI - String'*
#
Field
Description
Value
3
Element
The field on the source/target table this Field record is mapped to.
Additional comments
*
Property
The property in the payload the data will be written to.
Automatically populated
4
Description
Describe what this field is for and any specific details that might help you in future.
'The incident's comments'
#
Field
Description
Value
7
Element
The field on the source/target table this Field record is mapped to.
'Work notes'
*
Property
The property in the payload the data will be written to.
Automatically populated
8
Description
Describe what this field is for and any specific details that might help you in future.
'The incident's work notes'
# | Field | Description | Value |
2 | Message name | The message name that is unique for this integration. | 'UpdateIncident' |
3 | Type | The primary purpose of the message. | 'Update' |
4 | Direction | The direction(s) this message is configured to support. | 'Outbound' |
# | Field | Description | Value |
6 | Response | The immediate synchronous response to this message. | <lookup: 'Response'> |
7* | Async | Turn this option on if you want inbound processing to occur asynchronously or this message is the first of an asynchronous message pair. | <false> |
# | Field | Description | Value |
* | Bond ownership | 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. (Choices: Ignore, Must own, Must not own.) | 'Ignore' |
* | Bond condition type | 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.) | 'State' |
9 | Bond open | Process this message when the bond state is Open. | <true> |
# | Field | Description | Value |
11 | Outbound condition* | The condition that the ServiceNow record must meet to trigger this message being processed. | <Your condition> e.g. 'Work notes changes' OR 'Additional comments changes' |
# | Field | Description | Value |
13 | Path* | 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}. | '/table/incident/{bond.getValue("external_reference")}' |
14 | Action method | 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. | 'PUT' |