- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2019 05:05 AM
We have catalog items that generate REQ and Request Items in ServiceNow. We have a homemade third party app that knows the RITM number and needs to update variables on the RITM in ServiceNow from the home made application. Is there some oob API they can reference to POST updates to the variables of the RITM? What is the best way to have them update variables?
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2019 11:19 PM
HI,
Sorry for Delayed Response:
Follow below process:
1) Create Scripted Rest API put PUT method.
2) Give them one Predefined JSON format in which you want data from them, which will have your ritm number as well..
3) So you will have to parse this RITM number in Scripted REST API and then glide record this RITM and update the variables.
See below script:
var obj = '';
obj = request.queryParams.number; // This is our Query param for Finding RITM in System, You will have number
var state='';
var status='';
var reqbody = request.body;
var reqdata = reqbody.data;
if(obj && obj!=''){
var inc = new GlideRecord('sc_req_item');
inc.addQuery('number',obj);
inc.query();
if(inc.next()){
inc.variables.variable_name = reqdata.parameter;//Parameter means the key in JSON
status = 'success';
}
THanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2019 07:38 AM
Hi,
We have done this recently using Scripted Rest API. We use sys_id and correlation display field on RITM where third party tools number was saved.
This becomes easy as we know which RITM is related to which Request in other tool. Once both match then we scripted to update Variables.
Thanks,
Ashutosh Munot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2019 07:45 AM
Hello Ashutosh,
Thanks for taking the time to reply. It would be really nice if you could share the details. I have created REST message and Run Scripts before to POST to an external application, but I have not done a Scripted REST API to take a PUT from an external application to update the variables on our RITM form.
In my POST to them, I send the RITM number so they know the RITM number they want to update.
I just don't know what I need to build in ServiceNow to instruct them how to update the variables on the RITM record. Would you be able to share the steps or screen shots to get me started with what I need to create in ServiceNow and what I need to have them do for their PUT into ServiceNOw? I would appreciate the extra help with this request.
I can usually follow along in documentation but for this I'm having trouble even getting started.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2019 09:44 AM
I figured out a way to do this.
Probably not the best but works for me and has few moving parts.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2019 11:19 PM
HI,
Sorry for Delayed Response:
Follow below process:
1) Create Scripted Rest API put PUT method.
2) Give them one Predefined JSON format in which you want data from them, which will have your ritm number as well..
3) So you will have to parse this RITM number in Scripted REST API and then glide record this RITM and update the variables.
See below script:
var obj = '';
obj = request.queryParams.number; // This is our Query param for Finding RITM in System, You will have number
var state='';
var status='';
var reqbody = request.body;
var reqdata = reqbody.data;
if(obj && obj!=''){
var inc = new GlideRecord('sc_req_item');
inc.addQuery('number',obj);
inc.query();
if(inc.next()){
inc.variables.variable_name = reqdata.parameter;//Parameter means the key in JSON
status = 'success';
}
THanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2019 04:48 AM
Thanks Ashutosh. Much appreciated.
I will try this in my DEV.
Yesterday, I created a custom table. Had them do a POST to that table with the RITM number and the field value they wanted to update. I then used a transform map to take the values they added to the custom table into the sc_req_item using
(function transformRow(source, target, map, log, isUpdate) {
target.variables.computer_names=source.u_computer_names;
target.variables.parameters_file_location=source.u_parameter_file_location;
})(source, target, map, log, action==="update");