Chapter 23. Connecting to ServiceNow
An integration can retrieve records from a ServiceNow table or add records to a ServiceNow import set, which ServiceNow uses to update a table. In an integration, to connect to ServiceNow, create a ServiceNow connection and then add that connection to an integration. For details, see:
- Section 23.1, “Creating a ServiceNow connection”
- Section 23.2, “Obtaining records from ServiceNow to trigger integration execution”
- Section 23.3, “Creating an import set in ServiceNow”
- Section 23.4, “Copying records to ServiceNow during or to finish an integration”
- Section 23.5, “Example Salesforce to ServiceNow integrations”
23.1. Creating a ServiceNow connection
In an integration, to connect to your company’s ServiceNow instance, you must create a ServiceNow connection.
- A ServiceNow administrator at your site must have created a ServiceNow account for you.
- You must know the URL for your ServiceNow instance and your ServiceNow user name and password.
- If the ServiceNow administrator also created a ServiceNow client ID and client secret for you, you must know these values.
- In Fuse Online, in the left panel, click Connections to display any available connections.
- Click Create Connection to display Fuse Online connectors.
- Click the ServiceNow connector.
Configure this ServiceNow connection:
In the Instance Name field, enter the name of the ServiceNow instance that you want to obtain records from or copy records to. For example, if the URL for your ServiceNow instance is
https://abc12345.service-now.com, the instance name is
- In the User Name field, enter your ServiceNow user name.
- In the User Password field, enter your ServiceNow password.
- Optionally, in the Client ID field, enter your client ID if you received one from your ServiceNow administrator.
- Optionally, in the Client Secret field, enter your client secret if you received one from your ServiceNow administrator.
- Click Validate. Fuse Online immediately tries to validate the connection and displays a message that indicates whether validation is successful. If validation fails, update the configuration details as needed and try again.
- When validation is successful, click Next.
- In the Instance Name field, enter the name of the ServiceNow instance that you want to obtain records from or copy records to. For example, if the URL for your ServiceNow instance is
In the Name field, enter a name that helps you distinguish this connection from other connections. For example, enter
ServiceNow Con 1.
In the Description field, optionally enter any information that is helpful to know about this connection. For example, enter
ServiceNow connection that uses administrative credentials.
- Click Save to see that the connection you created is now available. If you entered the example name, you would see that ServiceNow Con 1 appears as a connection that you can choose to add to an integration.
23.2. Obtaining records from ServiceNow to trigger integration execution
To trigger execution of an integration upon receiving records from ServiceNow, add a ServiceNow connection to a simple integration as its start connection.
- You created a ServiceNow connection.
- You know the name of the table that you want to retrieve records from.
- You should have already defined a ServiceNow query that obtains only the records that you want. You can find information about ServiceNow queries here: ServiceNow encoded queries.
- In the Fuse Online panel on the left, click Integrations.
- Click Create Integration.
- On the Choose a connection page, click the ServiceNow connection that you want to use to start the integration.
- On the Choose an action page, select Retrieve Record to obtain records from a ServiceNow table that you select.
Configure the Retrieve Record action:
- Click in the Table name field and select the table that you want to obtain records from.
In the Query to filter the result set field, enter a ServiceNow query. For example, consider the
state=1^impact=2query on a table that keeps records about incidents. This query returns records for new incidents (
state=1) that have a medium impact (
impact=2). If you do not enter a query and the records in the table do not change, the connection obtains the same records every time.
In the Limit of elements per page field, enter the maximum number of records that you want the connection to obtain. In this release, you must enter a value, the recommendation is to enter
1000or less, and pagination is not supported.
- In the Period field, indicate how often you want to obtain records. The default is every minute. In other words, by default, Fuse Online executes this integration every 60 seconds.
- Click Next.
Fuse Online generates a JSON schema that defines the structure of the obtained records. This enables you to add a data mapping step before the next connection in the integration if data mapping is needed.
Fuse Online prompts you to choose a finish connection.
23.3. Creating an import set in ServiceNow
In a Fuse Online integration, a ServiceNow connection cannot directly update a ServiceNow table. To update ServiceNow data in an integration, a prerequisite is an import set that stages updates for a ServiceNow table.
Often, the easiest way to create an import set is for a ServiceNow administrator to create a ServiceNow inbound web service. This implicitly creates a ServiceNow import set. The import set is based on the ServiceNow target table that the administrator selects when creating the web service. A ServiceNow connection updates this import set, and ServiceNow uses the import set to update the corresponding ServiceNow table.
You must have ServiceNow administrative privileges.
Procedure in ServiceNow
In ServiceNow, search for
- In the results, under System Web Services > Inbound, click Create New.
In the Create Web Service page:
- In the Label field, specify the display name for the web service. The web service’s import set will also have this name.
- In the Target table field, select the ServiceNow table that this service updates.
- Select Copy fields from target table. This creates an import set that has the same schema as the target table. The import set is a staging area for updating the target table.
- Select Create transform map. This map enables ServiceNow to copy and transform data from the import set to the target table.
- Click Create.
- In the next display, under Related Links, click Auto Map Matching Fields to display a list of fields in the target table that you selected.
Select one target table field to be the correlation (or coalesce) field.
When the value of the correlation field in a record in the import set matches the value of a correlation field in the target table, ServiceNow updates that record in the target table rather than creating a new record.
- Select Coalesce to identify the field that you just selected as the correlation field. Without a correlation field, ServiceNow adds each record in the import set to the target table.
- Click Update.
Confirm that the transform map was created:
In ServiceNow, search for
- Under System Import Sets, click Transform Maps to display a list of transform maps.
- In this list, confirm that there is a transform map whose name is the value that you specified for the label of the web service that you created.
- In ServiceNow, search for
23.4. Copying records to ServiceNow during or to finish an integration
You can copy records to ServiceNow in the middle of a flow or to finish a simple integration. To do this, add a ServiceNow connection to the middle of a flow or as a simple integration’s finish connection.
- You created a ServiceNow connection.
- You are creating or editing a flow and Fuse Online is prompting you to add to the integration. Or, Fuse Online is prompting you to choose a finish connection.
- You know the name of the ServiceNow import set that you want to add records to. Your ServiceNow administrator can help you identify the appropriate import set. If the import set does not exist, see Creating an import set in ServiceNow.
- The ServiceNow import set is configured to handle the addition of records.
- On the Add to Integration page, click the plus sign where you want to add the connection. Skip this step if Fuse Online is prompting you to choose the finish connection.
- Click the ServiceNow connection that you want to add to the integration.
- Select the Add Record action.
- Click in the Import Set field and select the import set that you want to add records to.
- Click Next.
Fuse Online adds the connection to the flow.
Typically, a data mapper step is needed before this connection. In the integration visualization, Fuse Online displays on the connection. In most integrations, you need to map a source field to the target field used as the correlation field in the ServiceNow table.
23.5. Example Salesforce to ServiceNow integrations
This example describes two simple integrations:
- One integration obtains new cases from Salesforce and adds them as incidents to ServiceNow.
- The other integration obtains updated cases from Salesforce and updates a corresponding incident in ServiceNow.
Prerequisites (in ServiceNow)
For both integrations, a prerequisite is for a ServiceNow administrator to create an inbound web service. This implicitly creates a ServiceNow import set, which is required for an integration to add data to ServiceNow. For this example:
- The name of the web service is Cases from Salesforce.
- The service’s target table is Incidents. This table contains the data to be updated.
- The import set has the same schema as the Incidents table because of the selection of Copy fields from target table. The name of the import set is also Cases from Salesforce.
- ServiceNow can copy and transform data from the Cases from Salesforce import set to the Incidents target table because of the selection of Create transform map.
In the import set, the correlation field is
correlation_Idbecause of the selection of the
correlation_Idfield followed by selection of Coalesce.
Procedure overview (in Fuse Online)
In Fuse Online, you create the Salesforce and ServiceNow connections.
The two integrations are the same except for the action performed by the Salesforce connection, as noted in the following steps. To create the integrations, you would perform these steps twice, that is, once to create each integration:
Add the Salesforce connection as the start connection.
- To create the integration that obtains new cases, select the On create action.
- To create the integration that obtains updated cases, select the On update action.
- Select the Case object for the action to operate on. This Salesforce connection returns new Case objects or updated Case objects according to the chosen action.
- Add the ServiceNow connection as the finish connection.
Select the Create Record action, and then select Cases from Salesforce as the import set that the integration updates.
This ServiceNow connection adds new or updated Salesforce cases to the Cases from Salesforce import set.
Add a data mapper step that maps:
idto the ServiceNow import set’s
subjectto the ServiceNow
descriptionto the ServiceNow
- Salesforce case
Give the integration a name and then publish it.
- For the integration that obtains new cases, use On SF Create Case.
- For the integration that obtains updated cases, On SF Update Case.
Confirm that the integrations work
When both integrations are running, you can confirm that the integrations work:
- In Salesforce, create a case.
- In Fuse Online, view the summary for the On SF Create Case integration. Click its Activity tab to see that Fuse Online executed the integration once.
- In ServiceNow, view the Incidents table. You should see a new incident that has the subject and description that you specified in Salesforce.
- Back in Salesforce, update the case that you just created by changing its subject.
- In Fuse Online, view the summary for the On SF Update Case integration. Click its Activity tab to see that Fuse Online executed the integration once.
In ServiceNow, view the Incidents table and expand the entry for the incident that was previously new. You should see that this incident has an updated
short_descriptionvalue. ServiceNow checks the import set entry for the value of its
correlation_Id. If this value already exists in the Incidents table, ServiceNow updates the incident that has that value.