Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
This is what defines the connection between a Process and the single system it's connecting with. It is also where most of the configuration and settings are stored.
Back in the Unifi Integration Designer window, after clicking either on the '+' tile or 'New Integration', you are given a 'New Integration' modal to complete.
The fields to be configured for the New Integration modal are as follows:
Your 'New Integration' modal should look like this:
4) Click Create.
You will be redirected to the Details page of the newly created Integration.
Before continuing we would like to draw your attention to some of the relevant icons that are now visible down the left hand navigation strip.
The icons are:
a) 'Integration' icon: Opens the current integration's Details page.
b) 'Messages' icon: Opens the current integration's Messages page.
c) 'Fields' icon: Opens the current integration's Fields page.
d) 'Field Maps' icon: Opens the current integration's Field Maps page.
e) 'Documentation' icon: Opens the automatically generated documentation for the current integration. (Another awesome feature in Unifi.)
f) 'Connections' icon: Opens the current integration's Connections page.
The Details page of your Integration should look like this:
5) Navigate to Integration > Message Identification.
Unifi needs to identify the name of the inbound message in order to know how to process the inbound data.
6) Update the code in the 'Identify message script' field so that it looks like this:
The Message Identification form should look like this:
7) Navigate to Settings > Feedback.
The Feedback fields to be configured for the Integration record are as follows:
The Feedback Settings form should look like this:
All of the remaining 'Settings' values are to be left as-is:
Attachments Settings
Bond Settings
All of the 'Error handling' values are to be left as-is:
General
Timeouts
Retry
9) Click Save.
10) Click the 'Connections' icon to move on and configure the Connection.
#
Field
Description
Value
8
Enable UI messages
Allow information and error messages to be shown to the user as UI Notifications. Only applies to certain notifications.
<true>
#
Field
Description
Value
1
Name
The name of the integration.
<Your Name>
2
Service type
The type of web service this integration is using (SOAP/REST).
'REST'
3
Message format
Automatically pre-process incoming messages for simpler message scripting. (Choices: XML, JSON, Advanced)
'JSON'
The Connection allows messages to be sent and received and stores all the authentication details of the Integration specific to a single environment.
Before we configure our Connection, we need to ensure we have a user in the instance to use as the Inbound user for our Integration. To configure our Integration user:
In the native ServiceNow window, navigate to User Administration > Users. Click New.
The fields to be configured for the User record are as follows:
Your User record should look like this:
You can set up many connections to enable switching between environments (one connection per environment). However, only one connection can be active for an Integration at a time.
Remember: When setting up a Connection:
Make sure your SOAP and/or REST endpoints are unique.
Never use your own User as the Inbound User as it will prevent the integration from working.
Always ensure that your Inbound User is NOT used by anyone else for the same Process i.e. if you’re creating a Connection for an Integration on the Incident Process, your Inbound User has to be the only User used by an Integration within that Process.
We are going to configure a Connection for the Development environment.
Back in the Unifi Integration Designer window, click on the 'Connections' icon, then click New.
The fields to be configured for the New Connection modal are as follows:
The format of the Endpoint URL is as follows:
https://<your_instance>.service-now.com/<your_resource_path>
Your New Connection modal should look like this:
9) Click Submit and view.
Clicking 'Submit' will redirect you to the list view of the record you're creating. Clicking 'Submit and view' will redirect you to the newly created record.
The fields to be configured for the Details form are as follows:
Your Details form should look like this:
Feature Alert: The widget at the bottom of the page now shows the Integration as Active.
For this Development environment Connection, we have set the Endpoint URL to point to our own instance and used the same Integration User for both Inbound and Outbound (as created above). Being able to connect to our own instance makes it simple and efficient to test our integration (seeing Transactions going out and coming in) before we connect to the external system.
14) Save the Connection.
We are now ready to step back into the native ServiceNow window to configure the Trigger.
Follow this guide to configure a bidirectional asynchronous integration to the Incident table. This push-push integration will use Unifi both ends.
Congratulations on your decision to use Unifi, the only integration platform you need for ServiceNow. We are sure you will be more than satisfied with this extremely powerful, versatile and technically capable solution.
We have created this Guide as an aid to customers who are beginning their journey in deploying the Unifi integration platform. This document will guide you through an example of how to configure a bidirectional asynchronous Incident integration, sending and receiving messages via the Scripted REST Service.
This guide is here to help you get up and running as quickly as possible, enabling you to realise the enormous benefits to be gained when using Unifi to configure your integration.
For more technical information on how to use Unifi, please see our .
Do not build integrations directly within the Unifi application scope. This can create issues with upgrades and application management.
As with the previous release, the vast majority of the configuration is carried out in Unifi Integration Designer (our portal interface) - Processes, Integrations, Connections, Messages, Fields & Field Maps. Although there are many other elements which are configurable in the portal, they fall outside the scope of this document. For the purpose of this Guide, the remaining configuration elements are the Web Service & Trigger. These are to be configured in native ServiceNow as before.
We could have chosen to deal with those elements configured in the portal first & then move on to those configured in native ServiceNow. Instead, however, we have structured this Guide to align with the testing approach. Firstly, we shall configure the main elements which have to be in place for the Integration to work (Process, Web Service, Integration, Connection, Trigger), then we shall move on to build & test each of the scenarios individually. For example, build the CreateIncident Message (along with CreateIncidentReceipt & Response), configure the relevant Fields for those Messages and then test the CreateIncident Message. Then do the same for the UpdateIncident Message (& Receipt) and so on.
We want to include some advice on things to be aware of - either to ensure you do them, or avoid doing them - when building & testing Unifi integrations; in particular and especially if many people are building in one instance at the same time (whether that be a training instance or sub-production instance).
Make sure your Process API name is unique, otherwise use an existing Process.
Make sure your SOAP and/or REST endpoints are also unique.
When setting up a Connection:
Never use your own User as the Inbound User as it will prevent the integration from working.
Always ensure that your Inbound User is NOT used by anyone else for the same Process i.e. if you’re creating a Connection for an Integration on the Incident Process, your Inbound User has to be the only User used by an Integration within that Process.
When configuring a Trigger (Business Rule) on a table to be integrated, make sure one doesn’t exist already. If you have more than one, you will make duplicate updates.
The prerequisite to configuring Unifi is to have it installed on your instance. As with any other ServiceNow scoped application, Unifi must be purchased via the ServiceNow Store before installation.
We recommend you follow the Setup instructions prior to configuring your Integration.
This Guide utilises the Unifi Integration Designer portal interface which allows you to configure and manage integrations much more intuitively and with greater efficiency.
From within native ServiceNow, open the Unifi Integration Designer portal by navigating to [ws] Unifi > Unifi Integration Designer.
You will be greeted with the following Dashboard (which opens in a new window):
Any existing Processes will be listed as tiles, showing the number of Active Integrations for each.
If appropriate, you can either edit the Settings of, or add a New Integration to an existing Process by clicking the ellipsis (at the bottom right of the tile).
Hovering over the tile of an existing Process will display 'Show integrations'. Clicking it will take you to the Integrations page (for that Process).
In the next section, we shall look at configuring a new Process.
The first element to configure is the Process, which is the top level configuration element where all Integrations are contained.
The first thing to do when creating a new integration is to assign it to its Process. For instance, a new Incident integration would be created within an Incident Process. If you do not yet have a Process defined, then you will need to create a new Process
From the Unifi Integration Designer Dashboard, click on New Process.
On the 'New Process' modal, the fields to be configured are as follows:
*API Name
The API Name is how we identify which Process we are integrating with. The Scripted SOAP/REST Service will reference the API Name (which is why it is important for this to be a unique reference).
Your 'New Process' modal should look like this:
6) Click Create.
You will be redirected to your Process Dashboard:
Click either the '+' tile or 'New Integration' in preparation to configure the Integration.
Before we configure the Integration, however, we will first step back into the native ServiceNow window to configure the Web Service.
#
Field
Description
Value
6
Environment
The environment this connection applies to.
'Development'
7
Endpoint URL
The external system's access URL.
<External system Endpoint URL>
8
Active
Use this connection for the integration when true.
<true>
#
Field
Description
Value
10
Authentication
The authentication method to use for this connection.
'Basic'
11
User
The username used in basic authentication.
<external.system.user>
12
Password
The password used in basic authentication.
<External system user password>
13
Inbound user
The user profile used by the external system for authentication. An active connection must be found for the user to gain access.
<lookup: Your Inbound User>
# | Field | Description | Value |
1 | Name | The name of the ServiceNow process being integrated. | <SN Process Name> (e.g. Incident) |
2 | API Name* | The unique name of this process for use with the API. | <your_unique_api> |
3 | Target table | The primary target or process table that this integration uses. | 'Incident' [incident] |
4 | Reference field | The field on the target table that is used as the reference for the external system. | 'Number' |
5 | Description | Describe what this Process is for. | <Your description> |
#
Field
Description
Value
1
User ID
The id of the user (to be used by the external system for authentication).
<your.integration_user>
2
First name
The integration user's first name.
<Your First Name>
3
Last name
The integration user's last name.
<Your Last Name>
4
Password
The user's password (to be used in basic authentication).
<Your Password>
5
Roles
The role required for access to the integrated records.
'itil'
The Trigger is a Business Rule which stipulates the conditions under which Messages will be sent for the Process concerned.
When configuring a Trigger (Business Rule) on a table to be integrated, make sure one doesn’t exist already. If you have more than one, you will make duplicate updates.
In the native ServiceNow window, navigate to System Definition > Business Rules. Click New.
The Business Rule fields to be configured are as follows:
The top section of your Business Rule record should look like this:
Click on the 'When to run' tab and configure the fields as follows:
Your 'When to run' tab should look like this:
Click on the 'Advanced' tab and configure the fields as follows:
*Script:
The code in the script field should look like this:
Your 'Advanced' tab should look like this:
10) Click Submit.
The main elements are now in place for our Integration to work. We are now ready to configure and test each of our Scenarios in turn.
The entry point for a Process - you would build one endpoint per process. Once connected, messages are guided to the integration based on the unique combination of authentication user & endpoint.
In native ServiceNow, navigate to System Web Services > Scripted Web Services > Scripted REST APIs. Click New.
The Scripted REST Service fields to be configured are as follows:
The top section of your Scripted REST Service record should look like this:
3) Save the record.
Click on the 'Security' tab and configure the fields as follows:
Your 'Security' tab should look like this:
Save the record.
Navigate to the Resources Related List. Click New.
The 'Scripted REST Resource' fields to be configured are as follows:
*These fields are automatically populated.
The code in the Script field should look like this:
In the RestHelper function, change the value of the Process API name being called to match yours (e.g. 'incident_guide'). By wrapping the code in console, we give context to Activity Log and prevent multiple database updates.
The top section of your Scripted REST Resource should look like this:
Click on the 'Security' tab and configure the fields as follows:
Your 'Security' tab should look like this:
Click on the 'Content Negotiation' tab and configure the fields as follows:
Your 'Content Negotiation' tab should look like this:
11) Click Submit.
With the introduction of the Packager feature, if you want the Web Service to be included in the packaged update set, you will need to update the value of the REST Service field on the Process record with the name of your Scripted REST Service. This will enable the Packager to pick it up.
Whilst still in native ServiceNow, navigate to [ws] Unifi > Configuration > Processes.
Click to open < Your Process >.
12) Update the value in the REST Service field with < Your Scripted REST Service > (as created above).
13) Click Update.
We will now move back to the Unifi Integration Designer window to configure the Integration.
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 our Create Scenario are:
Response
CreateIncidentReceipt
CreateIncident
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.
In Unifi Integration Designer, click on the 'Messages' icon & then New to begin configuring the Response Message.
The fields to be configured for the New Message modal are as follows:
Your Response New Message modal should look like this:
4) Click Submit.
You will be redirected to the Messages page. We need not configure our Response Message any further.
Next, we shall move on and configure the CreateIncidentReceipt Message.
The CreateIncidentReceipt Message is the asynchronous receipt that is sent after processing the Createincident Message.
After clicking the 'Messages' icon, you will see the following screen (note: the previously configured message is visible in the list):
1) Click New.
The fields to be configured for the CreateIncidentReceipt New Message modal are as follows:
Your CreateIncidentReceipt 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:
Your Response form should look like this:
7) Navigate to Inbound > Settings.
The Inbound Settings fields to be configured are as follows:
The code in the 'Reference lookup script' field should look like this:
Reference lookup script: In an asynchronous integration it's important to identify which message an asynchronous receipt is replying to. This script extracts the transaction's unique identifier.
In the case of an inbound create/update it would return their external message id (source id) to identify which transaction our asynchronous receipt belongs to. In the case of an inbound asynchronous receipt it would return our internal message id (target id) to identify which transaction their asynchronous receipt belongs to.
Your Inbound Settings form should look like this:
9) Navigate to Advanced > Script Editor.
The Scripts are where the request processing and data mapping occurs. They are also the place where Bond state & ownership are set.
When you first open the Script Editor, you will see the following:
Having visibility of your message scripts in the one pane makes scripting so much more efficient.
Because we are dealing with an inbound message, we can adjust the view to only show the 'Payload to Stage' & 'Stage to Target' script fields.
10) Navigate to View > Inbound.
Your Script Editor fields will initially look like this:
The Script Editor fields to be configured are as follows:
The code in the 'Stage to Target' script field should look like this:
Your Script Editor fields should now look like this:
12) Click 'Save'.
13) Click 'Close' to navigate back to the Message.
We are now ready to configure the Fields for our CreateIncidentReceipt Message.
We will utilise the Field & Field Map records to configure the Message Scripts for the CreateIncidentReceipt Message.
It is worth copying all relevant OOTB Field Maps as are necessary for your integration before using any of them in your Field Records - thereby mitigating the risk of any potential issues with future upgrades.
The Field Maps we shall use for our CreateIncidentReceipt Field records are:
Message Header
Receipt Status
To copy the Message Header Field Map, navigate to the 'Field Maps' icon.
1) Click on the ellipsis to the right of the Message Header Field Map & then click Copy.
The fields to edit for the Copy Field Map modal are as follows:
*Name: We have chosen to prefix the existing Field Map Name with the initials of our Integration (you are free to choose any appropriate means of identifying/differentiating).
Your Copy Field Map modal should look like this:
4) Click Copy.
You will be redirected to the Details page of the newly created Field Map.
Repeat the process for the Receipt Status Field Map.
From the CreateIncidentReceipt Message, navigate to Message > Fields. Click New.
The fields to be configured for our message_header New Field modal are as follows:
*These fields are automatically defaulted to true, or automatically populated.
**Field map: Value may vary. Choose the copy Field Map you created for your Integration.
Your 'message_header' New Field modal should look like this:
10) Submit the record.
You will be redirected back to the Fields page of the CreateIncidentReceipt Message.
Click New.
The fields to be configured for our transaction_details New Field modal are as follows:
*These fields are automatically defaulted to true, or automatically populated.
**Field map: Value may vary. Choose the copy Field Map you created for your Integration.
Your 'transaction_details' New Field modal should look like this:
16) Submit the record.
You will be redirected back to the Fields page of the CreateIncidentReceipt Message.
Now that we’ve configured the Field records for the CreateIncidentReceipt message, we are ready to build our message scripts.
The following Field records should now be in place for your CreateIncidentReceipt messsage:
17) Click on Build Message.
You will see the 'Message build successful' Info Message.
18) 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 was already there.
Stage to Target:
The code in the ‘Stage to Target’ script field should look like this:
We are now ready to configure our CreateIncident Message.
The CreateIncident Message will create a ticket on the target table of the integrated system.
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 CreateIncident New Message modal are as follows:
Your CreateIncident 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.
The code in the 'Outbound condition' script field should look like this:
This is an example of data-driving the trigger condition. This script checks whether the integration that this message belongs to is listed in a custom field on the assignment group which references the integration.
Your Outbound Trigger form should look like this:
12) Navigate to Outbound > Settings.
The Outbound Settings fields to be configured are as follows:
Your Outbound Settings form should look like this:
14) Navigate to Inbound > Settings.
The Inbound Settings fields to be configured are as follows:
*This field is automatically populated & not editable.
Bond reference method:
Internal - lookup using the internal reference only.
External - lookup using the external reference only.
Both - lookup using both the internal and external references.
Bond reference method: The perspective of the available choices is in relation to the receiving instance i.e. Internal (internal reference) means the bonded ticket in our instance and External (external reference) means the bonded ticket in their instance.
Primarily used in relation to create and update type messages, these settings define which values to lookup against to search for and validate whether or not a bond already exists.
In the case of a create type message, we use 'External' because there is not yet a bonded ticket in the receiving instance to reference (if we were to receive a create type message which referenced a bond that already existed it would be rejected because we don't want to create another bond for a record we've already seen ).
In the case of an update type message, we use 'Both' because it's a more accurate method of validating updates are being sent to/received from the correct bonded records.
The code in the 'Reference lookup script' field should look like this:
Your Inbound Settings form should look like this:
16) Navigate to Advanced > Script Editor.
As previously stated, as well as being the place where Bond state & ownership are set, the Scripts are where the request processing and data mapping occurs.
Click on View > Inbound.
The Script Editor fields to be configured are as follows:
The code in the 'Stage to Target' script field should look like this:
Your Script Editor fields should now look like this:
18) Click Save.
19) Close the Script Editor to navigate back to the Message.
We are now ready to configure the Fields for our CreateIncident Message.
We will utilise the Field & Field Map records to configure the Message Scripts for the CreateIncident Message.
The ‘message.message_header’ Field record is visible and inactive. It is an Integration level Field which was automatically created by Unifi at the time we created the Message level record (as per the 'CreateIncidentReceipt Fields' page). We’ll talk more about Integration level & Message level Fields in the '' section.
It is now easier than ever to create a Message level Field record for its Integration level counterpart.
From the CreateIncident Message, navigate to Message > Fields.
1) Find the message.message_header (Integration level) Field & set Active to true.
Feature Alert: 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). Note: the empty 'circle icon' indicates that the Integration level Field is available to add to the Message.
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 a select few Incident record field elements.
The Field records we will focus on will be for Caller (Reference), Short description (String) and State (Choice).
If you haven't already, you will need to copy the relevant additional Field Maps for the CreateIncident Field records as follows:
Reference
String
Choice
From the CreateIncident Message, navigate to Message > Fields. Click New.
The fields to be configured for the incident.caller_id New Field modal are as follows:
*These fields are automatically defaulted to true, or automatically populated.
**Field map: Value may vary. Choose the copy Field Map you created for your Integration.
Your 'incident.caller_id' New Field modal should look like this:
6) Submit the record.
You will be redirected back to the Fields page of the CreateIncident Message.
Click New.
The fields to be configured for the incident.short_description New Field modal are as follows:
*These fields are automatically defaulted to true, or automatically populated.
**Field map: Value may vary. Choose the copy Field Map you created for your Integration.
Your 'incident.short_description' New Field modal should look like this:
11) Submit the record.
You will be redirected back to the Fields page of the CreateIncident Message.
Field records can exist at both the Integration and the Message level (a Field record exists at the Integration level if it isn't linked to a Message i.e. the 'Message' field element is left blank). We noted previously that an Integration level Field record is automatically created when we first create one at the Message level. We will utilise and configure both when mapping 'incident.state'.
The 'incident.state' Field record is a Choice 'type' Field. These are used when you’re mapping choice field elements with static values that don't change per Message (e.g. State, Impact, Urgency) i.e. you're not going to have one set of choices/values for create and another for update.
Rather than configure choices for each Message, configure choices once at the Integration level. This means you only need define them once. The Field Map will take care of it and any 'incident.state' Field records that are set at the Message level (i.e. with a value in the 'Message' field) would use the choices configured at the Integration level.
We'll first configure the Message level Field and then move on to configure the choices on its Integration level counterpart.
There is no need to 'Generate field choices' for Message level Field records because the Field Map always looks for them on an Integration level Field which has the same name.
From the CreatIncident Message, navigate to Message > Fields. Click New.
The fields to be configured for our incident.state (Message level) New Field modal are as follows:
*These fields are automatically defaulted to true, or automatically populated.
**Field map: Value may vary. Choose the copy Field Map you created for your Integration.
Your 'incident.state' (Message level) New Field modal should look like this:
16) Submit the record.
You will be redirected back to the Fields page of the CreateIncident Message.
We will need to 'Generate field choices' for this Integration level Choice 'type' Field.
Navigate to the 'Fields' icon to open the Fields page.
17) Click to open the incident.state (Integration level) Field record (the one where Message is empty).
The incident.state Field record opens to the Details page.
18) Navigate to Field > Field Choices.
19) Click Generate field choices.
20) Click Generate on the 'Generate field choices' modal which displays.
The Field Choices are generated & now visible in the list.
Now that we’ve configured the Field records for the CreateIncident message, we are ready to build our message scripts.
From the CreateIncident message, navigate to Message > Fields.
The following Field records should now be in place for your CreateIncident messsage:
21) Click on Build Message.
You will see the 'Message build successful' Info Message.
22) 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 was already there.
Stage to Target:
The code in the ‘Stage to Target’ script field should look like this:
We are now ready to Test our CreateIncident Message.
We will primarily by utilising OOTB Fields & Field Maps to configure our Message Scripts. In the current release, however, there is no OOTB Field Map record with which we can set the state on the Bond. We shall, therefore, script that manually. For more information , see the ' & '' pages in our technical documentation.
Feature Alert: In the picture above you will notice that a 'Build Integration' button has appeared in the banner at the top of the page. Whenever a change is made to a Field record that is associated to a Message (whether that is being created, updated, or deleted) the button will be available and acts as a visual reminder that changes have been made and Message Script(s) need to be built. We will talk more about this feature in the page.
The code we had previously added when configuring our Message as per the '' page is still in place and can be seen after the End Comment.
In the current release, there is no OOTB Field Map record with which we can set the state on the Bond. We shall, therefore, script that manually. For more information, see the ' & '' pages in our technical documentation.
Depending on your requirements, you will need to create Field records for each of the relevant Incident record field elements (see the table below for an example). For the sake of brevity, this Guide will focus on a select few. If you wish, however, you are free to continue & configure the remaining Field records. The table below lists an example of the Incident record field elements you may wish to map and the relevant Field Maps required to configure each Field record. For a fuller definition of available Field Maps, please see the relevant page in our .
See (on the 'CreateIncidentReceipt Fields' page) for details.
At this stage, you could carry on and configure any remaining Field records for the rest of the Incident record field elements (as per your requirements - see the at the top of this section). However, we will now run the Build process to auto-generate our Message Scripts.
The code we had previously added when configuring our Message as per the '' page is still in place and can be seen after the End Comment.
#
Field
Description
Value
5
When
When this business rule should execute relative to the database operation.
'before'
6
Insert
Select this check box to execute the business rule when a record is inserted into the database.
<true>
7
Update
Select this check box to execute the business rule when a record is update.
<true>
8
Order
The sequence in which this business rule should run.
'1,000,000,000'
#
Field
Description
Value
9
Script*
The script to run.
Replace the entire contents of the script field with your business rule code, substituting the name of your business rule (see below). E.g. 'Business rule: Unifi Incident trigger'
#
Field
Description
Value
4
Default ACLs
The ACLs to enforce when accessing resources. Individual resources may override this value.
[Blank]
#
Field
Description
Value
5
Name
The name of this API resource. Appears in API documentation.
<Your Name>
6
HTTP method
The HTTP method that maps to this resource.
'POST'
*
Relative path
The path of this resource relative to the base API path. Can contain templatized path parameters such as /{id}.
'/' (Automatically populated)
7
Script
The script that implements the resource.
Replace the contents of the script field with your REST API code, substituting your Process API name (see below). E.g. var helper = new x_snd_eb.RestHelper('incident_guide');
#
Field
Description
Value
8
Requires ACL authorization
Enforce ACLs when this resource is accessed.
<false>
#
Field
Description
Value
9
Override supported request formats
Check to customize the request media types supported by this resource.
<true>
10
Supported request formats
Comma-delimited list of media types this resource can consume.
*
# | Field | Description | Value |
2 | Message name | The message name that is unique for this integration. | 'CreateIncidentReceipt' |
3 | Type | The primary purpose of the message. | 'Receipt' |
4 | Direction | The direction(s) this message is configured to support. (Choices: Inbound, Outbound, Bidirectional) | 'Bidirectional' |
# | Field | Description | Value |
6 | Response | The immediate synchronous response to this message. | <lookup: 'Response'> |
# | Field | Description | Value |
8 | Reference lookup script | The script containing functions for extracting internal and external references from the request payload. | Update the code in the Reference lookup script field so that it looks like the code below |
# | Field | Description | Value |
11 | Stage to Target (Inbound) | The script to run. | Replace the commented out instructions with the following code: bond.setOpen(); |
# | Field | Description | Value |
2 | Name* | The name of your field map. (If left unedited, it will append the word 'Copy' to the existing name.) | <Your Name> |
3 | Integration | The integration this field map is associated with. | <Your Integration> |
# | Field | Description | Value |
* | Message | The Message this Field record is linked with. | 'CreateIncidentReceipt' |
5 | Description | Describe what this field is for and any specific details that might help you in future. | 'The protocol message header' |
* | Active | Set to true to use this Field record for processing. | <true> |
6 | Field map | The Field Map this Field record is linked with. | 'IG Message Header'** |
7* | Map to field | Use this Field record to represent a field on a source/target table. | <false> |
8 | Path | Where in the payload the data will be placed. | 'message' |
9 | Property | The property in the payload the data will be written to. | 'message_header' |
* | Inbound | Set to true to use for inbound Messages. | <true> |
* | Outbound | Set to true to use for outbound Messages. | <true> |
# | Field | Description | Value |
* | Message | The Message this Field record is linked with. | (automatically populated) |
11 | Description | Describe what this field is for and any specific details that might help you in future. | 'Used to send and receive transaction process errors' |
* | Active | Set to true to use this Field record for processing. | <true> |
12 | Field map | The Field Map this Field record is linked with. | 'IG Receipt Status'** |
13* | Map to field | Use this Field record to represent a field on a source/target table. | <false> |
14 | Path | Where in the payload the data will be placed. | 'message' |
15 | Property | The property in the payload the data will be written to. | 'transaction_details' |
* | Inbound | Set to true to use for inbound Messages. | <true> |
* | Outbound | Set to true to use for outbound Messages. | <true> |
# | Field | Description | Value |
2 | Message name | The message name that is unique for this integration. | 'CreateIncident' |
3 | Type | The primary purpose of the message. | 'Create' |
4 | Direction | The direction(s) this message is configured to support. | 'Bidirectional' |
# | Field | Description | Value |
6 | Response | The immediate synchronous response to this message. | <lookup: 'Response'> |
* | Async | Turn this option on if you want inbound processing to occur asynchronously or this message is the first of an asyncronous message pair. | <true> |
7 | Async receipt | The asynchronous receipt to this message. | <lookup: 'CreateIncidentReceipt'> |
# | 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 new | Process this message when a new bond is required. | <true> |
# | Field | Description | Value |
11 | Outbound condition* | The condition that the ServiceNow record must meet to trigger this message being processed. | Update the Outbound condition script field with the code below |
# | Field | Description | Value |
13 | 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. | 'POST' |
# | Field | Description | Value |
* | Bond reference method | Method of searching for and validating an existing bond for incoming messages. | 'External' |
15 | Reference lookup script | The script containing functions for extracting internal and external references from the request payload. | Update the code in the Reference lookup script field so that it looks like the code below |
# | Field | Description | Value |
17 | Stage to Target (Inbound) | The script to run. | Replace the commented out instructions with the following code: bond.setOpen(); |
Incident Field | Field Map |
caller_id | Reference |
short_description | String |
description | String |
category | Choice |
impact | Choice |
urgency | Choice |
state | Choice |
comments | Journal field |
work_notes | Journal field |
# | Field | Description | Value |
* | Message | The Message this Field record is linked with. | 'CreateIncident' |
2 | Description | Describe what this field is for and any specific details that might help you in future. | 'The caller on this incident' |
* | Active | Set to true to use this Field record for processing. | <true> |
3 | Field map | The Field Map this Field record is linked with. | 'IG Reference'** |
* | Map to field | Use this Field record to represent a field on a source/target table. | <true> |
* | Table | The primary source/target table that this Field record is mapped to. | 'Incident' [incident] |
4 | Element | The field on the source/target table this Field record is mapped to. | 'Caller' |
5 | Path | Where in the payload the data will be placed. | 'detail' |
* | Property | The property in the payload the data will be written to. | Automatically populated |
* | Inbound | Set to true to use for inbound Messages. | <true> |
* | Outbound | Set to true to use for outbound Messages. | <true> |
# | Field | Description | Value |
* | Message | The Message this Field record is linked with. | 'CreateIncident' |
7 | Description | Describe what this field is for and any specific details that might help you in future. | 'The short description of the incident' |
* | Active | Set to true to use this Field record for processing. | <true> |
8 | Field map | The Field Map this Field record is linked with. | 'IG String'** |
* | Map to field | Use this Field record to represent a field on a source/target table. | <true> |
* | Table | The primary source/target table that this Field record is mapped to. | 'Incident' [incident] |
9 | Element | The field on the source/target table this Field record is mapped to. | 'Short description' |
10 | Path | Where in the payload the data will be placed. | 'detail' |
* | Property | The property in the payload the data will be written to. | Automatically populated |
* | Inbound | Set to true to use for inbound Messages. | <true> |
* | Outbound | Set to true to use for outbound Messages. | <true> |
# | Field | Description | Value |
* | Message | The Message this Field record is linked with. | 'CreateIncident' |
12 | Description | Describe what this field is for and any specific details that might help you in future. | 'The incident lifecycle state' |
* | Active | Set to true to use this Field record for processing. | <true> |
13 | Field map | The Field Map this Field record is linked with. | 'IG Choice'** |
* | Map to field | Use this Field record to represent a field on a source/target table. | <true> |
* | Table | The primary source/target table that this Field record is mapped to. | 'Incident' [incident] |
14 | Element | The field on the source/target table this Field record is mapped to. | 'State' |
15 | Path | Where in the payload the data will be placed. | 'detail' |
* | Property | The property in the payload the data will be written to. | Automatically populated |
* | Inbound | Set to true to use for inbound Messages. | <true> |
* | Outbound | Set to true to use for outbound Messages. | <true> |
#
Field
Description
Value
1
Name
The name of the business rule.
<Your Name>
2
Table
The table that this business rule will run on.
‘Incident’ [incident]
3
Active
Set to true to enable this business rule.
<true>
4
Advanced
Set to true to reveal the advanced version o the form.
<true>
#
Field
Description
Value
1
Name
The name of the API. Appears in API documentation.
<Your Name>
2
API ID
The API identifier used to distinguish this API in URI paths. Must be unique within API namespace.
Automatically populated
*
API namespace
The namespace the API belongs to. The value depends on the current application scope.
Automatically populated
*
Base API path
The base API path (URI) to access this API.
Automatically populated (after 'Save')
# | Field | Description | Value |
1 | Message name | The message name that is unique for this integration. | 'Response' |
2 | Type | The primary purpose of the message. | 'Response' |
3 | Direction | The direction(s) this message is configured to support. (Choices: Inbound, Outbound, Bidirectional) | 'Bidirectional |
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 our Update Scenario are:
Receipt
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 UpdateIncident Message is an update type message that sends updates to the bonded record.
Again, after clicking the 'Messages' icon, you are directed to the following screen (note: the four 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:
11) 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. In this case it makes sense to use this message to send an update where the state doesn't change. Typically, we would configure different messages to align with state changes (e.g. Close, Resolve).
The code in the 'Outbound condition' script field should look like this:
Your Outbound Trigger form should look like this:
13) Navigate to Inbound > Settings.
The Inbound Settings fields to be configured are as follows:
*Bond reference method:
Internal - lookup using the internal reference only.
External - lookup using the external reference only.
Both - lookup using both the internal and external references.
As mentioned earlier, because this is an update type message, we use 'Both' as it's a more accurate method of validating updates are being sent to/received from the correct bonded records.
The code in the 'Reference lookup script' field should look like this:
Your Inbound Settings form should look like this:
16) Click Save.
We are now ready to configure the Fields for our UpdateIncident Message.
The Receipt Message is the asynchronous receipt that is sent after processing update type messages.
Again, after clicking the 'Messages' icon, you are directed to the following screen (note: the three previously configured messages are now visible in the list):
1) Click on the ellipsis to the right of the CreateIncidentReceipt Message & click Copy.
Rather than create the Receipt Message from scratch, it will be quicker to copy the CreateIncidentReceipt Message and make one minor change.
The fields to edit for the Copy Message modal are as follows:
Your Copy Message modal should look like this:
3) Click Copy.
You will be redirected to the Details page of the newly created Receipt Message.
Navigate to Advanced > Script Editor, then View > Inbound.
Your Script Editor fields should initially look like this:
The Script Editor fields to be edited are as follows:
The code in the 'Stage to Target' script field should look like this:
Your Script Editor fields should now look like this:
5) Click Save.
6) Click Build Message.
You will see the 'Message build successful' Info Message.
7) Click the 'Messages' icon to move on & configure the UpdateIncident Message.
There is no further configuration required for the Receipt Message.
Follow these steps to test the 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.
You should see an Info Message, confirming the UpdateIncident Message is being sent to your Integration:
The Work note is added to the Activities stream on the 'Notes' tab:
Click through to the Bond record from the related list on the Incident.
Your Bond record should have been updated as follows:
3) History:
< History updated on the Bond > (Sending UpdateIncident...)
4) 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:
5) 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)
6) 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)
7) Stages:
Direction: 'Outbound' & 'Inbound'
Message: 'UpdateIncident' & 'Receipt'
Internal reference: < ServiceNow ticket reference > (Same as 'Document')
External reference: < External system's ticket reference >
Click through to the Outbound Stage record from the related list on the Transaction. (If you wish, you could also do the same for the Inbound Stage record.)
Check the values in the fields match what you expect.
Your Stage record should look like this:
8) Stage details:
Direction: 'Outbound'
External reference: < External system's ticket reference >
Internal reference: < ServiceNow ticket reference >
Message: 'UpdateIncident'
Transaction: < Your Transaction >
Integration: < Your Integration >
9) Mapped stage fields:
work_notes: < Your Work note >
Click through to the Outbound HTTP Request record from the related list on the Transaction. (If you wish, you could also do the same for the Inbound HTTP Request record.)
Your HTTP Request record should look like this:
10) 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: 'POST'
Request headers: < The header of the request being sent >
Request payload: < The payload of the request being sent >
11) 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):
12) 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?
As when testing our CreateIncident Message, if completing this test after having integrated with the external system (as opposed to connecting to your own instance), it would be good to test the UpdateIncident Message in both directions.
We are now ready to move to the Resolve Scenario.
Follow these steps to test the CreateIncident Message.
Because we have configured Unifi to connect to itself, we don't need to wait until we've connected to the external system before we test. We can test both sending and receiving Messages in the one instance. It goes without saying that these tests should be repeated once we have connected to the external instance.
To test, we will create an incident in our instance and then follow the data as it flows through the Unifi transport stack and on to the newly created ticket (whether that be in our instance, or in the external system we are integrating with).
We have data-driven the trigger for our Create Message so that it fires when a ticket is assigned to an assignment group which has the integration referenced on it. In order to test then, we’ll need to add our integration to the Unifi Integrations field on the assignment group that triggers our incidents. We will create a new assignment group as an example.
In native ServiceNow, navigate to User Administration > Groups. Click New.
The Group fields to be configured are as follows:
*Unifi Integrations: This field may need to be created/added to the Group [sys_user_group] record.
Your Group record should look like this:
4) Submit.
In native ServiceNow, navigate to Incident > Create New.
The Incident fields to configure are as follows:
*Note: We have chosen these fields as these were the ones we mapped when creating our Field records for the CreateIncident Message. Your choices may differ depending on which Field records you created.
Your Incident form should look like this:
8) Right-click & Save.
Note the values entered (including State), so that you can check them against the mapped fields on the corresponding record in the instance being integrated to.
You should see an Info Message, confirming the CreateIncident Message is being sent to your Integration:
When you scroll down to the 'Unifi Integrations' related list (you may have to configure the related lists to add it to your Incident form), notice:
9) A Bond has been created. The State remains 'Pending' until the list is refreshed.
10) Refresh the list by clicking Bonds.
You should see the External reference populated & the State changed to 'Open':
11) Click the Bond Number link to open the Bond record.
Your Bond record should look like this:
12) Bond details:
Integration: < Your Integration >
Connection: < Your Connection >
Table: 'Incident [incident]'
Document: < Your Incident >
State: 'Open' (Message exchange is available)
Status: 'OK' (All transactions have completed)
Internal reference: < ServiceNow ticket reference > (Same as 'Document')
External reference: < External system's ticket reference >
13) History:
< History of transaction updates on the Bond > (Sending CreateIncident...)
14) Transaction:
Message ID: Internal system's unique Transaction identifier
External Message ID: External system's unique Transaction identifier
Message: 'Createincident'
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)
You are able to view the logs in the 'Unifi Activity Logs' related list.
15) Transaction process next queued: Logs from checking whether there are any other transactions queued and processing those.
16) Transaction receive message: Logs from processing the inbound asynchronous receipt.
17) Transaction sending: Logs from taking the Stage data, building the Request record & sending the Request to the integrated system.
18) Business rule: < Your Trigger >: Logs from the Business Rule that triggered Unifi.
Click through to the Transaction record from the related list on the Bond.
Your Transaction record should look like this:
19) Transaction details:
Table: 'Incident [incident]'
Document: < Your Incident >
Integration: < Your Integration >
Connection: < Your Connection >
Bond: < Your Bond >
Message: 'CreateIncident'
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)
20) 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)
21) Stages:
Direction: 'Outbound' & 'Inbound'
Message: 'CreateIncident' & 'CreateIncidentReceipt'
Internal reference: < ServiceNow ticket reference > (Same as 'Document')
External reference: < External system's ticket reference >
Click through to the Outbound Stage record from the related list on the Transaction. (If you wish, you could also do the same for the Inbound Stage record.)
Check the values in the fields match what you expect.
Your Stage record should look like this:
22) Stage details:
Direction: 'Outbound'
Internal reference: < ServiceNow ticket reference >
Message: 'CreateIncident'
Transaction: < Your Transaction >
Integration: < Your Integration >
23) Mapped stage fields (yours may differ depending on which Field records you created.):
caller_id: < Your caller.id >
short_description: < Your Short description >
state: '1'
Click through to the outbound HTTP Request record from the related list on the Transaction. (If you wish, you could also do the same for the Inbound HTTP Request.)
This is where you will find details of the data that was transported between the systems being integrated. (These records are extremely useful for developing and debugging integrations because of the immediate availability and contextual relevance to the integration you are developing.)
Your HTTP Request record should look like this:
24) HTTP Request details:
Integration: < Your Integration >
Connection: < Your Connection >
Transaction: < Your Transaction >
Message: 'CreateIncident'
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: 'POST'
Request headers: < The header of the request being sent >
Request payload: < The payload of the request being sent >
25) 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):
26) Caller: < Your Caller >
27) State: < Your State >
28) Short description: < Your Short description >
29) Activities: < Note showing activity on the Incident > (Opened by < your.external.system.user > configured in the Connection)
30) Bond: Note that a bond exists in the external system in an 'Open' state and the 'Internal reference' & 'External reference' are reversed
If completing this test after having integrated with the external system (as opposed to connecting to your own instance), it would be good to test the CreateIncident Message in both directions.
We are now ready to move to the Update Scenario.
We will utilise the Field & Field Map records to configure the Message Scripts for the UpdateIncident Message.
The 'message_header' (Integration level) Field record should already be in place (i.e. with Active set to false). We will now create its Message level counterpart.
From the UpdateIncident Message, navigate to Message > Fields.
Your UpdateIncident Fields page should look like this:
1) Find the message.message_header (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). Note: the empty 'circle icon' indicates that the Integration level Field is available to add to the Message.
As before, by setting the Active flag to true on the Integration level Field record listed on the Message, Unifi has automatically created the Message level counterpart.
Next, repeat the process for the incident.short_description Field.
The 'incident.short_desccription' (Integration level) Field record should already be in place (i.e. with Active set to false). We will now create its Message level counterpart.
Your UpdateIncident Fields page should look like this:
2) Find the incident.short_description (Integration level) Field & set Active to true.
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).
We will now configure Field records for two other Incident record field elements.
As with the CreateIncident Message and depending on your requirements, you will need to create Field records for each of the relevant Incident record field elements (see the table in Fields & Field Maps on the 'CreateIncident Fields' page for an example). For the sake of brevity, this Guide will focus on two of those. If you wish, however, you are free to configure other Field records as required.
The table below lists the Incident record field elements we will map and the relevant Field Maps required to configure each Field record.
If you haven't already, you will need to copy the relevant additional Field Maps for the UpdateIncident Field records as follows:
Journal field
See Copy Field Maps (on the 'CreateIncidentReceipt Fields' page) for details.
From the UpdateIncident Message, navigaate to Message > Fields & click New.
The fields to be configured for our incident.comments New Field modal are as follows:
*These fields are automatically defaulted to true, or automatically populated.
**Field map: Value may vary. Choose the copy Field Map you created for your Integration.
Your 'incident.comments' New Field modal should look like this:
7) Submit the record.
You will be redirected back to the Fields page of the UpdateIncident Message.
Because the incident.work_notes Field record is the same 'type' (IG Journal field) & the majority of the settings are the same as the previously configured Field, it will be quicker to copy the incident.comments Field & make a few minor changes.
8) 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:
11) Click Copy.
You will be redirected to the Details page of the 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.
To quickly navigate to the UpdateIncident Message from the Details page of the newly created incident.work_notes Field record…
...click the 'Preview' icon to the left of the Message field.
From the UpdateIncident message, navigate to Message > Fields.
The following Field records should now be in place for your UpdateIncident messsage:
12) Click on Build Message.
You will see the 'Message build successful' Info Message.
13) 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 was already there.
We are now ready to Test our UpdateIncident Message.
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 Message we shall be configuring for our Resolve Scenario is:
ResolveIncident
We will define which Field records require configuring for that Message 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 ResolveIncident Message is an update type message that we will configure to deal specifically with our resolve scenario (resolve the bonded records).
Again, after clicking the 'Messages' icon, you are directed to the following screen (note: the five previously configured messages are now visible in the list):
1) Click the ellipsis to the right of the UpdateIncident Message & then click Copy.
Rather than create the ResolveIncident Message from scratch, it will be quicker to copy the UpdateIncident Message and make some minor changes.
The fields to edit for the Copy Message modal are as follows:
Your Copy Message modal should look like this:
3) Click Copy.
You will be redirected to the Details page of the newly created ResolveIncident Message.
Navigate to Message > Bond.
The Bond fields to be edited are as follows:
Your Bond form should look like this:
6) Navigate to Outbound > Trigger.
The Outbound Trigger (as required)* fields to be edited 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. in this case it makes sense to send the Resolve message when the Incident is Resolved.
Your Outbound Trigger form should look like this:
9) Click Save.
We are now ready to configure the Fields for our ResolveIncident Message.
We will utilise the Field & Field Map records to configure the Message Scripts for the ResolveIncident Message.
The 'message_header', 'incident.comments', 'incident.work_notes' and 'incident.short_description' Field records are already be in place because they were also copied when we copied the Message. We can choose to include, or exclude as many of those and the Integration level ones that are available depending on our requirements (by either activating or deactivating the relevant Fields). We have chosen not to include 'incident.short_description' in our mappings, so we'll delete that.
In Unifi Integration Designer, from the ResolveIncident Message, navigate to Message > Fields.
1) Click on the ellipsis to the right of the incident.short_description Field & click Delete.
2) Confirm Delete.
Deleting here only deletes the Field record for this message. The integration level record and any other message level ones remain in place.
Unifi created the incident.state (Integration level) Field record earlier. It is, therefore, displayed in the list with Active set to false.
The fields to be changed to configure the incident.state (Message level) Field record are as follows:
By simply setting the Active flag to true on the Integration level Field record listed on the Message, Unifi has created the Message level counterpart.
Your ResolveIncident Message Fields page should look like this:
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).
We will now configure Field records for the two remaining Incident record field elements which are required.
The table below lists the Incident record field elements we will map and the relevant Field Maps required to configure each Field record.
*Field map: Values may vary (dependent on your configuration of the copies). Choose the copy Field Maps you created earlier.
There is no need to ‘Generate field choices’ for Message level Field records because the Field Map always looks for them on an Integration level Field which has the same name.
As with 'incident.state' the 'incident.close_code' Field record is a Choice 'type' Field. We will, therefore, configure the choices once at the Integration level. We’ll first configure the Message level Field and then move on to configure the choices on its Integration level counterpart.
From the ResolveIncident Message, navigate to Message > Fields. Click New.
The fields to be configured for our incident.close_code (Message level) New Field modal are as follows:
*These fields are automatically defaulted to true, or automatically populated.
**Field map: Value may vary. Choose the copy Field Map you created for your Integration.
Your 'incident.close_code' (Message level) New Field modal should look like this:
9) Submit the record.
You will be redirected back to the Fields page of the ResolveIncident Message.
You will need to 'Generate field choices' for this Integration level Choice 'type' Field.
Navigate to the 'Fields' icon to open the Fields page.
10) Click to open the incident.close_code (Integration level) Field record (the one where Message is empty).
The incident.close_code Field record opens to the Details page.
11) Navigate to Field > Field Choices.
12) Click Generate field choices.
13) Click Generate on the 'Generate field choices' modal which displays.
The Field Choices are generated & now visible in the list.
Because the incident.close_notes Field record is the same 'type' (IG Journal field) & the majority of the settings are the same as the incident.work_notes Field, it will be quicker to copy that Field & make a few minor changes.
From the ResolveIncident Message, navigate to Message > Fields.
14) Click the ellipsis next to the incident.work_notes Field record & click Copy.
The fields to edit for the Copy Field modal are as follows:
*This field is automatically populated.
Your 'incident.close_notes' Copy Field modal should look like this:
17) Click Copy.
You will be redirected to the Details page of the newly created incident.close_notes Field record.
Navigate to Field > Settings.
18) Set Mandatory to true.
19) Click Save.
Now that we’ve configured the Field records for the ResolveIncident message, we are ready to build our message scripts.
To quickly navigate to the ResolveIncident message from the Details page of the newly created incident.close_notes Field record…
...click the 'Preview' icon to the left of the Message field.
From the ResolveIncident message, navigate to Message > Fields.
The following Field records should now be in place for your ResolveIncident messsage:
20) Click on Build Message.
You will see the 'Message build successful' Info Message.
21) 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 was already there.
We are now ready to Test our ResolveIncident Message.
Building the other half of our integration is much easier than you think.
If you're asking yourself, 'Do we have to do all that again?' the short answer is no, we don't. When using Unifi both ends, building the other half of the integration is a simple two-stage process.
First we Move the Integration, exporting it from one instance and importing it to the other (creating a mirror image in the other instance).
Second we Reconfigure the Connections so that each is pointed at the other.
We will look at both in more detail over the next couple of pages.
It is possible to run the Build process from the Integration. This will cause the process to cycle through each of the Messages on the Integration in turn.
We have been running the Build process at the Message level in order to see the changes in our Message Scripts as we go. This may be considered good practice (particularly when first starting out) as any discrepancies can be discovered & rectified as you go (in potentially fewer, smaller batches). Once you are more practiced and confident in the accuracy of your configurations, you can run the Build process at the Integration level. This means that the process will cycle through all the Field records on each of the Messages on the Integration in turn & auto-generate all the relevant Message Script code.
As mentioned in the page, we saw that a 'Build Integration' button had appeared in the banner at the top of the page. This was because, whenever a change is made to a Field record that is associated to a Message (whether that is being created, updated, or deleted) the button will be available and act as a visual reminder that changes have been made and Message Script(s) need to be built.
To run the Build Process at the Integration level we have two choices. We can either either run it from the Integration record, or we can use the 'Build Integration' button which appears in the banner at the top of the page.
To run it from the Integration record. In Unifi Integration Designer, navigate to: 'Integration' icon.
1) Click Build.
2) On the Build Integration modal, click Build.
When complete, you will see the following Integration Build Worker modal:
3) Click Done.
Navigate to: 'Messages' icon.
Feature Alert: The widget at the bottom of the page also shows when 'Build' was last run.
Click through each Message in turn, navigating to Advanced > Script Editor to view the auto-generated code in the Message Scripts.
We have now built and tested the integration in one instance. We are now ready to move on and Build the other half.
Follow these steps to test the ResolveIncident Message.
Navigate to < Your Incident > created in the earlier test.
Update the Incident record as follows:
Your Incident record should look like this:
4) Right-click & Save.
You should see an Info Message, confirming the ResolveIncident Message is being sent to your Integration:
The Activities stream is updated with the details:
Click through to the Bond record from the related list on the Incident.
Your Bond record should have been updated as follows:
5) History:
< History updated on the Bond > (Sending ResolveIncident...)
6) Transaction:
Message: 'Resolveincident'
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:
7) Transaction details:
Table: 'Incident [incident]'
Document: < Your Incident >
Integration: < Your Integration >
Connection: < Your Connection >
Bond: < Your Bond >
Message: 'ResolveIncident'
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)
8) 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)
9) Stages:
Direction: 'Outbound' & 'Inbound'
Message: 'ResolveIncident' & 'Receipt'
Internal reference: < ServiceNow ticket reference > (Same as 'Document')
External reference: < External system's ticket reference >
Click through to the Outbound Stage record from the related list on the Transaction. (If you wish, you could also do the same for the Inbound Stage record.)
Check the values in the fields match what you expect.
Your Stage record should look like this:
10) Stage details:
Direction: 'Outbound'
External reference: < External system's ticket reference >
Internal reference: < ServiceNow ticket reference >
Message: 'ResolveIncident'
Transaction: < Your Transaction >
Integration: < Your Integration >
11) Mapped stage fields:
close_code: < Your Resolution code >
close_notes: < Your Resolution notes >
state: '6'
Click through to the Outbound HTTP Request record from the related list on the Transaction. (If you wish, you could also do the same for the Inbound HTTP Request record.)
Your HTTP Request record should look like this:
12) HTTP Request details:
Integration: < Your Integration >
Connection: < Your Connection >
Transaction: < Your Transaction >
Message: 'ResolveIncident'
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: 'POST'
Request headers: < The header of the request being sent >
Request payload: < The payload of the request being sent >
13) 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):
14) State: 'Resolved'
15) Activities: < Your Resolution code/notes & State > (added by < your.external.system.user >)
Navigate to the Resolution Information tab.
Your Resolution Information tab should look like this:
16) Resolution code: < Your Resolution code >
17) Resolution notes: < Your Resolution notes >
As when testing our previous scenarios, if completing this test after having integrated with the external system (as opposed to connecting to your own instance), it would be good to test the ResolveIncident Message in both directions.
If you have completed this testing for the first time (sending to your own instance only), you are now ready to move on and look at running Build at the Integration level.
#
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.
'Bidirectional'
#
Field
Description
Value
6
Response
The immediate synchronous response to this message.
<lookup: 'Response'>
*
Async
Turn this option on if you want inbound processing to occur asynchronously or this message is the first of an asynchronous message pair.
<true>
7
Async receipt
The asynchronous receipt to this message.
<lookup: 'Receipt'>
#
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 pending
Process this message when the bond state is Pending.
<true>
10
Bond open
Process this message when the bond state is Open.
<true>
#
Field
Description
Value
12
Outbound condition*
The condition that the ServiceNow record must meet to trigger this message being processed.
Update the Outbound condition script field with the code below
#
Field
Description
Value
14
Bond reference method*
Method of searching for and validating an existing bond for incoming messages.
'Both'
15
Reference lookup script
The script containing functions for extracting internal and external references from the request payload.
Update the code in the Reference lookup script field so that it looks like the code below
#
Field
Description
Value
2
Message name
The message name that is unique for this integration.
'Receipt'
#
Field
Description
Value
4
Stage to Target (Inbound)
The script to run.
Delete the following code that sits outside of the End tag: bond.setOpen();
#
Field
Description
Value
5*
Caller
Person who reported or is affected by this incident.
<Your Caller>
*
State
The Incident lifecycle state.
'New' - Default (Automatically populated)
6
Assignment group
The group which triggers the Integration.
<Your Group>
7*
Short description
A brief description of the incident.
<Your Short description>
Incident Field
Field Map
comments
Journal field
work_notes
Journal field
#
Field
Description
Value
*
Message
The Message this Field record is linked with.
'UpdateIncident'
3
Description
Describe what this field is for and any specific details that might help you in future.
'The incident's comments'
*
Active
Set to true to use this Field record for processing.
<true>
4
Field map
The Field Map this Field record is linked with.
'IG Journal field'**
*
Map to field
Use this Field record to represent a field on a source/target table.
<true>
*
Table
The primary source/target table that this Field record is mapped to.
'Incident' [incident]
5
Element
The field on the source/target table this Field record is mapped to.
'Additional comments'
6
Path
Where in the payload the data will be placed.
'detail'
*
Property
The property in the payload the data will be written to.
Automatically populated
*
Inbound
Set to true to use for inbound Messages.
<true>
*
Outbound
Set to true to use for outbound Messages.
<true>
#
Field
Description
Value
9
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
10
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. | 'ResolveIncident' |
# | Field | Description | Value |
4 | Bond suspended | Process this message when the bond state is Suspended (internal suspend). | <true> |
5 | Bond vendor suspended | Process this message when the bond state is Vendor suspended (external suspend). | <true> |
# | Field | Description | Value |
7 | Outbound condition* | The condition that the ServiceNow record must meet to trigger this message being processed. | 'State > changes to > Resolved' |
8 | Outbound condition* | The script that must be met for the message to be processed. Use current to get access to the triggering record. | [Blank] |
# | Field | Description | Value |
3 | Active | Set to true to create a Message level Field record from its Integration level counterpart. | <true> |
Incident Field | Field Map |
close_code | 'IG Choice'* |
close_notes | 'IG Journal field'* |
# | Field | Description | Value |
* | Message | The Message this Field record is linked with. | 'ResolveIncident' |
4 | Description | The description of this Field record. | 'The incident's Resolution code (Close code in ServiceNow)' |
* | Active | Set to true to use this Field record for processing. | <true> |
5 | Field map | The Field Map this Field record is linked with. | 'IG Choice'** |
* | Map to field | Use this Field record to represent a field on a source/target table. | <true> |
* | Table | The primary source/target table that this Field record is mapped to. | 'Incident' [incident] |
6 | Element | The field on the source/target table this Field record is mapped to. | 'Resolution code' |
7 | Path | Where in the payload the data will be placed. | 'detail' |
* | Property | The property in the payload the data will be written to. | Automatically populated |
* | Inbound | Set to true to use for inbound Messages. | <true> |
* | Outbound | Set to true to use for outbound Messages. | <true> |
8 | Mandatory | Set to true to make mandatory. | <true> |
# | Field | Description | Value |
15 | Element | The field on the source/target table this Field record is mapped to. | 'Resolution notes' |
* | Property | The property in the payload the data will be written to. | Automatically populated |
16 | Description | The description of this Field record. | 'The incident's Resolution notes (Close notes in ServiceNow)' |
Congratulations on completing this bidirectional asynchronous Incident integration Guide.
This Guide has shown us how to configure an asynchronous Incident integration, sending bidirectional messages via the REST service. The elements we configured were:
Process
Web Service
Integration
Connections
Trigger
Messages
Fields
In testing our integration, we created, updated and resolved an Incident - following the data as it flowed from our ServiceNow Incident record, through the Unifi transaction message bus, to the external system's Incident record.
By Using the Unifi integration platform, we have discovered that building and testing our integration is simpler and more efficient, saving both time and money. Our hope is that this Guide has been a valuable aid to you in that process.
For further information please see our technical documentation.
If you have any feedback or questions, please contact us via our website contact form.
#
Field
Description
Value
1
Name
Descriptive name, e.g. DBAs, Network, etc.
<Your Name
2
Type
Types of this group.
'itil'
3
Unifi Integrations*
Glide List referencing the Integration [x_snd_eb_integration] table.
<Your Integration>
# | Field | Description | Value |
1 | State | The Incident lifecycle state. | 'Resolved' |
2 | Resolution code | The Incident resolution code. | <Your Resolution code> |
3 | Resolution notes | The Incident resolution notes. | <Your Resolution notes> |
The next step in building the other half of the Integration is to reconfigure the connections.
Now that both halves of the Integration are in place, we need to reconfigure each of the Connections to point to the other instance. Before doing that though, we need to create a new Inbound User for the external instance.
To configure our Integration user:
In native ServiceNow, navigate to User Administration > Users. Click New.
The fields to be configured for the User record are as follows:
This Inbound user will become the Outbound user in the other instance. We will need to update the other instance accordingly.
We are going to edit the existing 'Development' Connection so that it will become our 'Test' Connection and use the Inbound user just created.
We will need to have our other instance point to this external one also (not only to itself). Therefore, we will create a new 'Test' Connection in the other instance to do that. (See the next section.)
In Unifi Integration Designer, navigate to the 'Connections' icon.
6) Click to open the previously created Development Connection to edit it.
Edit the values in the Connection as follows:
*Inbound user created above.
Your Connection form should look like this
We have not updated the Endpoint URL nor the Outbound User because they already contain the correct values (i.e. the internal instance's Endpoint & Inbound user).
9) Save the Connection.
Back in the internal instance, navigate to the 'Connections' icon. Click New.
We could have edited our existing 'Development' Connection to point to the external instance (instead of itself). We have chosen instead to create a new 'Test' Connection to do that. That way we have two Connections, a 'Development' Connection which points to itself and a 'Test' connection which points to the external instance.
The fields to be configured for the New Connection modal are as follows:
The format of the Endpoint URL is as follows:
https://<your_instance>.service-now.com/<your_resource_path>
For this Test environment Connection, we have edited the Development Connection, changing the <your_instance>
element of the Endpoint URL to point to the external system instance (leaving the <your_resource_path>
element unchanged). For our Outbound User we have used the external system's Inbound User (as created above).
Your New Connection modal should look like this:
13) Submit and view to further configure the Connection.
Clicking ‘Submit’ will redirect you to the list view of the record you’re creating. Clicking ‘Submit and view' will redirect you to the newly created record.
The fields to be configured for the Details form are as follows:
(External) User/Password: As created above & set in the external instance.*
Your Details form should look like this:
18) Save the Connection.
There will now be both a Development and a Test Connection for your Integration. Only the Test Connection should be Active.
These can be viewed by clicking the 'Connections' icon.
We have completed building the other half of the Integration. We are now ready to go back and repeat the Testing for each of the scenarios we've built.
See the following pages:
The first step to building the other half of the Integration is to export it from one instance and import it to the other.
Using the Packager feature makes moving integrations between instances simpler and more efficient than ever.
In Unifi Integration Designer, navigate to and open < Your Integration >.
Click the 'Integration' icon to open the Details page.
Click Package.
The Package Integration modal is displayed.
Confirm by clicking Package.
Unifi packages the Integration into an Update Set which is automatically downloaded.
The Integration Package Worker modal is displayed.
The modal tells us how many records were processed and the name of the Update Set that was created (the integration name prepended with the date/time).
Copy the name of the Update Set.
Click Done to close the modal.
Navigate to the downloaded Update Set and Show in folder*.
*Example shown in Chrome. Other browsers may vary.
Then rename the file (using your Update Set name in order to easily identify it when uploading to the other instance).
In the Application Navigator of the external instance, navigate to System Update Sets > Retrieved Update Sets.
At the bottom of the Retrieved Update Sets list, click the Import Update Set from XML related link.
If you have the UI16 Developer Patch installed (download from Share by clicking here), you can navigate directly to the Import XML page from the context menu of the Update Set Picker by clicking Import from XML.
The Import XML screen is displayed:
Click Choose file to upload the previously downloaded file.
Upload.
You are redirected back to the Retrieved Update Sets list view:
Open the Update Set
Your Retrieved Update Set form is displayed:
Click Preview Update Set.
Close the Update Set Preview modal.
Click Commit Update Set.
Close the Update Set Commit progress modal.
We have successfully installed the application containing our Integration on the external instance. The vast majority of the configuration is already in place. All that remains is to make a few configuration changes and Reconfigure the Connections to enable each instance to connect with the other.
#
Field
Description
Value
1
User ID
The id of the user (to be used by the external system for authentication).
<your.integration.user>
2
First name
The integration user's first name.
<Your First Name>
3
Last name
The integration user's last name.
<Your Last Name>
4
Password
The user's password (to be used in basic authentication).
<Your Password>
5
Roles
The role required for access to the integrated records.
<roles needed, e.g. itil>
#
Field
Description
Value
7
Environment
The environment this connection applies to.
'Test'
8
Inbound user
The user profile used by the external system for authentication.
<Your Inbound user*>
#
Field
Description
Value
10
Environment
The environment this connection applies to.
'Test'
11
Endpoint URL
The external system's access URL.
<External system Endpoint URL>
12
Active
Use this connection for the integration when true.
<true>
#
Field
Description
Value
14
Authentication
The authentication method to use for this connection.
'Basic'
15
User*
The username used in basic authentication.
<external.system.user>
16
Password*
The password used in basic authentication.
<External system user password>
17
Inbound user
The user profile used by the external system for authentication. An active connection must be found for the user to gain access.
<lookup: Your Inbound User>