ServiceNow integration with Salesforce

What is ServiceNow?

ServiceNow is a business service management platform that offers you IT support services, whether you are an IT business or handling the IT services. For reducing the work effort, getting work done with ease, enhancing resolution speed and minimizing cost, ServiceNow uses artificial intelligence and Machine learning. It increases productivity by performing a common business process with automated tools. It is designed keeping small, medium and large enterprises’ requirements in mind, be it customer requests, fast service resolution, scalability or maintaining the workflow.

ServiceNow and Salesforce integration benefits

ServiceNow and Salesforce both are the major CRM systems, ServiceNow integration with Salesforce offers any business to run smoothly. It eases the work by providing access to multiple apps and synchronizing the data faster. Here are some benefits 


This integration offers ServiceNow to Salesforce and Salesforce to ServiceNow synchronization. This two-way synchronization enables the user to make use of both the platform’s functionality by logging into one system, without switching from one to another.

Managing the business processes

Any organization’s business processes can be managed at one platform through ServiceNow that includes the collection of data, storage and application development. It allows seamless customer communication and fast query resolution.

Easy coordination

ServiceNow and Salesforce integration enables coordination between teams by reducing communication barriers. The data and work are visible to both the sales and support team that makes resolution faster and precise.

Real-time access

A complete update on the customer request, priority and resolution. It accelerates the resolution time and helps to keep complete track from the query issued to the query resolved.


A step-by-step guide to integrate ServiceNow with Salesforce

Let’s start with Obtaining a Personal Developer Instance

1.      Log in to the ServiceNow developer site.

2.      Open the ‘Manage’ menu and click the ‘Instance’ menu item.

3.      Click the ‘Request Instance’ button.

  1. Select a ServiceNow version for the instance.
  2. When the instance is assigned, the screen updates to display the instance URL and the admin credentials. Copy the admin password to the clipboard.



6. Click on the URL as shown in the attachment above it redirects to the login page use the Username and Password shown in the attachment above.

Here is the Apex Callout Code for the Case Insertion on the ServiceNow from the Salesforce.


The trigger for the Case insertion:

trigger ServiceNow on Case (after insert) {

 for(Case c : Trigger.New){

 nameofyourcalloutclass.servicenowPost(c.CaseNumber); }



Above is the trigger which fires when the new Case is generated from the Salesforce organization. Class is called from the trigger which contains the whole functionality.


Apex Class for the Callout.

public class InsertCase{

@future(callout = true)

public static void servicenowPost(String incidentCase){

Http http = new Http();

 HttpRequest req = new HttpRequest();

 HttpResponse res = new HttpResponse();

String username = ‘admin’;

String password = ‘$Test12345’;

Blob headerValue = Blob.valueOf (username + ‘:’ + password);

String authorizationHeader = ‘BASIC ‘+ EncodingUtil.base64Encode(headerValue); req.setHeader(‘Authorization’, authorizationHeader); req.setEndpoint(‘;

 req.setMethod(‘POST’); req.setHeader(‘Content-Type’, ‘application/json’); JSONGenerator gen = JSON.createGenerator(true); gen.writeStartObject();

//you can add as many mappings as you want gen.writeStringField (‘servicenowField’, incidentCase);


 //you can now use String pretty as your body

String pretty = gen.getAsString();


 HttpResponse res = http.send(req); system.debug(res.getBody());




After creating Trigger and class, create a Case in your Salesforce organization and login to the ServiceNow instance. Search the Incident in the search menu and open the incident. Find the incident with the same case number on the ServiceNow instance.

Now the ServiceNow and Salesforce integration completed successfully, the features and functionalities of both the CRM systems can be used from one system.

Leave a comment