0% found this document useful (0 votes)
8 views7 pages

Integrations (Import Set API & Table API)

ServiceNow integration connects the ServiceNow platform with other systems for data exchange and workflow automation using methods like APIs and IntegrationHub. The document outlines the process for using the Import Sets API and Table API, detailing steps for setting up REST messages, creating credentials, and implementing business rules for data synchronization. It provides specific instructions for configuring both sender and receiver instances to facilitate seamless integration between ServiceNow and external applications like Jira and Google Forms.

Uploaded by

Chaitanya Tadaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views7 pages

Integrations (Import Set API & Table API)

ServiceNow integration connects the ServiceNow platform with other systems for data exchange and workflow automation using methods like APIs and IntegrationHub. The document outlines the process for using the Import Sets API and Table API, detailing steps for setting up REST messages, creating credentials, and implementing business rules for data synchronization. It provides specific instructions for configuring both sender and receiver instances to facilitate seamless integration between ServiceNow and external applications like Jira and Google Forms.

Uploaded by

Chaitanya Tadaka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

SERVICENOW INTEGRATION

ServiceNow integration is the process of connecting the


ServiceNow platform with other systems and applications to enable seamless
data exchange and automate workflows. This connection allows different
tools to work together smoothly, sharing information and automating
processes. Common methods for integration include using APIs,
IntegrationHub, and web services.

Table of Contents:
• Import sets API.
• Table API.
• ServiceNow to Jira.
• Jira to ServiceNow.
• Jira Spoke.
• Google form integration.

Import Sets API:


The Import Set API allows external systems to push data into
ServiceNow tables using Import Sets. Import Sets are temporary tables in
ServiceNow used to stage data imported from various sources before
transforming and loading it into target tables.

*Pre-Requisites:
1. API / Endpoint
2. Credentials
3. Payload

Step-1: (Receiver Instance)


=> Navigate to All > Web services > Inbound > Create New.
=> Fill the main Fields (Label and Target Table).
=> Enable the Copy fields from target table for Copy entire fields from an existing target
table.
=> In related links click on Mapping Assist and map some fields of your choice.
=> Use Mapping Assist to map fields.

=> Now Check Web service Under Inbound click on it.

=> After opening the Edit web services, navigate to related links > click on Explore
REST API.
=> Explore REST API and create a Request Body.
=> Now REST API Explorer page will be opened with API name as Import set API and
POST method.
=> Now click on send. HTTP Method, Status Code, and Response body will be
generated.

HTTP Method / URI: POST


https://dev208055.service-now.com/api/now/import/u_imp_set_api
Status code: 201 Created

Response Body:
{ "import_set": "ISET0010004",
"staging_table": "u_imp_set_api",
"result": [
{
"transform_map": "Imp_set_API",
"table": "incident",
"display_name": "number",
"display_value": "INC0010077",
"record_link":
"https://dev208055.service-now.com/api/now/table/incident/81391ddf93320210bf463
1697bba1018",
"status": "inserted",
"sys_id": "81391ddf93320210bf4631697bba1018"
}
]
}

To integrate we need to have:


1. API
2. Credentials
3. Payload
To create Credentials, we need to create a user for it. Set password for the user.

Step-2 (Sender Instance):


=> Navigate to All > web services > Outbound > REST Messages.

=> Create REST Message with endpoint URL and HTTP methods.
=> Click on NEW to create a new REST Message, Fill the all-Mandatory fields.
=> Name: (Message name)
=> Endpoint: (instance URL, ex: https://dev264155.service-now.com/)
=> In the Authentication section > Authentication type > Basic.
=> Now we need to create a Basic auth profile, click new > fill the username and
Password, and select it.
=> In HTTP Request section > HTTP Headers need to-be filled, and submitted.

Content-Type : application/json
Accept : application/json

=> And Default GET Method will be created, we need to create new POST Method so
select POST in HTTP Method field and ENDPOINT field will need to be filled with
API/HTTP Method URL (From Receiver > HTTP Method / URI

=> POST https://dev208055.service-now.com/api/now/import/u_imp_set_api).


ex: https://dev208055.service-now.com/api/now/import/u_imp_set_api

Authentication type: Inherit from parent


=> HTTP Request > content > From Receiver instance > Request Body
{"u_caller_id":"ITIL User","u_active":"true","u_assigned_to":"Bow Ruggeri"}

=> Now click on SAVE, and in Related links check the TEST and it will return HTTP
status as 201 and New record will be created in Receiver instance.

=> Now in the content we need to pass the values dynamically, we will add variables in
value places by using “${}”.
{"u_caller_id":"${caller}","u_active":"${active}","u_assigned_to":"${assignTo}"}
=> After clicking Auto-generate variables in Related links, we can see the variables in the
Variable Substitutions section.
=> Now copy the script in the Preview Script Usage and create a Business Rule.
=> Select the required fields and paste the script in the advanced section.
=> Enter the variable values in the script.
Ex: r.setStringParameterNoEscape('caller',current.caller_id);

Table API
The Table API provides endpoints that allow you to perform create, read,
update, and delete (CRUD) operations on existing tables.

Step 1: Set Up REST API Access on Source Instance.

=> Create an API User for credentials:


=> Go to User Administration > Users.
=> Create a new user (e.g., api.user) with necessary roles (e.g., rest_api_explorer).

Generate an API Key:


=> Go to System Web Services > REST API Explorer.
=> Use the explorer to understand the available APIs and endpoints.

Step 2: Configure REST Message in Source Instance

Create REST Message:


=> Go to System Web Services > Outbound > REST Message.
=> Click on New and configure the REST message with:
*Name: Sync to Target Instance
*Endpoint: URL of the target instance's REST API
(e.g., https://target_instance.service-now.com/api/now/table/your_table).

Set Up HTTP Methods:


=> Configure the necessary HTTP methods (e.g., GET, POST, PUT, DELETE) for
the required actions.
For POST and PUT, set up the request body to include the data you want to send.

Step 3: Create Business Rule or Script to Trigger Data Sync

Create a Business Rule:


=> Go to System Definition > Business Rules.
=> Create a new business rule that triggers on insert/update/delete events on the source
table.
=> In the Script field, write a script to call the REST message created in the previous
step.

(function executeRule(current, previous /*null when async*/ ) {


if (current.operation() == "insert") {
try {
var r = new sn_ws.RESTMessageV2('Table_RM', 'Table_Method');
r.setStringParameterNoEscape('caller', current.caller_id);
r.setStringParameterNoEscape('des', current.description);
r.setStringParameterNoEscape('short_des', current.short_description);
r.setStringParameterNoEscape('assigned_to', current.assigned_to);

var response = r.execute();


var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.log("Table_APi_inte:" + httpStatus + "&&" + responseBody + "&&", "table
api shashank");
var refbody = JSON.parse(responseBody);
current.correlation_id = refbody.result.sys_id;
current.setWorkflow(false);
current.update();

} catch (ex) {
var message = ex.message;
}
}
})(current, previous);

Step 4: Test the Integration

Insert/Update/Delete Records:
=> Perform insert/update/delete operations on the source instance's table.
=> Check logs and target instances to ensure data is synchronized correctly.

You might also like