You need to sign in to do that
Don't have an account?
sushanth s 2
map salesforce case with incident fields in servicenow?
Hi,
I'm trying to integrate salesforce and serviceNow.If i create a new case in salesforce that is saved as incident in serviceNow Here i developed some code but i'm stucked at mapping the salesforce case fields with serviveNow incident fieds.
this is my basu code
Public with sharing class OutboundMsg {
public static void servicenowPost(){
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('https://dev23577.service-now.com/');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
//Id caseId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
// Case c = new Case(subject='',status='new',origin='web');
//insert c;
// req.setBody('c');
// Create a new http object to send the request object
// A response object is generated as a result of the request
res = http.send(req);
System.debug(res.getBody());
}
}
anyone suggest how to estrablish the mapping between salesforce and serviceNow.
Thanks
I'm trying to integrate salesforce and serviceNow.If i create a new case in salesforce that is saved as incident in serviceNow Here i developed some code but i'm stucked at mapping the salesforce case fields with serviveNow incident fieds.
this is my basu code
Public with sharing class OutboundMsg {
public static void servicenowPost(){
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('https://dev23577.service-now.com/');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
//Id caseId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
// Case c = new Case(subject='',status='new',origin='web');
//insert c;
// req.setBody('c');
// Create a new http object to send the request object
// A response object is generated as a result of the request
res = http.send(req);
System.debug(res.getBody());
}
}
anyone suggest how to estrablish the mapping between salesforce and serviceNow.
Thanks
Please find the suggested solution from the stack exchange community.
The ServiceNow API accepts json/xml you'll have to change your content-type to application/json and create the mappings in a json format. You can use the JSON Generator to build your request.
Here's a quick example:
Apex Class: Thanks,
Nagendra.