ServiceNow Integration with Dell's warranty API

Ben Cervantes
Kilo Expert

Has anyone integrated Dell's Warranty API with their ServiceNow instance. We just received our sandbox API keys and were looking for guidance on where to begin. 

20 REPLIES 20

I am using a REST message with GET as the HTTP method. When I run the test under the REST message I am getting the result I am expecting. I am using the "Query Dell Warranty Information" from the Service Now Share site. I think the problem is in the Script included:

 

var DellWarrantyInfoREST = Class.create();
DellWarrantyInfoREST.prototype = Object.extendsObject(AbstractAjaxProcessor,{

updateWarrantyInfo: function(){
gs.log('update warrenty info');
var r = new sn_ws.RESTMessageV2('DellWarranty', 'GET');
s.setStringParameter('id', this.getParameter('sysparm_id'));
gs.log('id' + this.getParameter('sysparm_id'));
r.setParameter('serviceTags', this.getParameter('sysparm_id'));
r.setParameter('applicationName', 'AssetService');
r.setParameter('guid', this._guid());


var response = s.execute();
gs.log("RESPONSE: " + response);

var resp = new XMLDocument(response);
var nodes = resp.getNodes("//Entitlements");

gs.log("Number of entitlements: " + nodes.getLength());

//Delete old records
var w = new GlideRecord("dell_warranty_info");
//w.addQuery("computer", this.getParameter('sysparm_id'));
//w.deleteMultiple();

gs.log("Deleted old records");

//Add new warranty info for the computer
for(var i=1; i<=nodes.getLength()+1; i++){
gs.log("Entitlement: " + resp.getNodeText("//AssetEntitlement["+i+"]/ServiceLevelDescription"));
var base = "//EntitlementData["+i+"]/";
var dwi = new GlideRecord("dell_warranty_info");
dwi.initialize();
dwi.computer = this.getParameter('sysparm_id');
dwi.service_level_code = resp.getNodeText(base+"ServiceLevelCode");
dwi.service_level_description = resp.getNodeText(base+"ServiceLevelDescription");
dwi.provider = resp.getNodeText(base+"Provider");
var ds = resp.getNodeText(base+"StartDate").substring(0, resp.getNodeText(base+"StartDate").indexOf("T"));
var de = resp.getNodeText(base+"EndDate").substring(0, resp.getNodeText(base+"EndDate").indexOf("T"));
//dwi.start_date.setDisplayValueInternal(""+resp.getNodeText(base+"StartDate"));
var dwts = new GlideDateTime(ds+" 00:00:00");
dwi.start_date=dwts;
var dwte = new GlideDateTime(de+" 00:00:00");
dwi.end_date = dwte;
dwi.status = resp.getNodeText(base+"EntitlementType");
dwi.insert();
}
},

_s4:function() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
},

_guid:function() {
return this._s4() + this._s4() + '-' + this._s4() + '-' + this._s4() + '-' +
this._s4() + '-' + this._s4() + this._s4() + this._s4();
},

type: 'DellWarrantyInfoREST'
});

 

 

 

Are you using this for your integration or something else/

I'm pretty sure that the script available on Share is no longer valid, as Dell changed from the older web service to a new API.

Thanks, any updates? 🙂

Rick Mann
Tera Expert

Hello Ben

I'm curious to see how you were able to build the integration with TechDirect.  We are looking to build out the same functionality and I'm currently working to get our API key approved.  Thanks for any tips or lessons learned you can share.

Rick

Marcel H_
Tera Guru

I have been wanting to do this for quite some time, but just now getting around to it. I have my TechDirect account set up, and requested my API keys, so hopefully will have those in a few days.

 

Ben - Would you mind sharing with the thread what you ended up doing for your successful implementation on the ServiceNow side? Once I have my API keys I'd like to get this set up and tested as soon as possible and get it checked off my to-do list. Any help you can provide would be very appreciated. Thanks!