how to Get sys_id by using RITM number

pankaj39
Kilo Explorer

HI Buddy,

Any idea how to get sys_id of a record using RITM number

medium is REST API

can you please forward me the REST api url

 

 

 

1 ACCEPTED SOLUTION

Tony Chatfield1
Kilo Patron

Hi, I would use the RESDT table API
https://developer.servicenow.com/dev.do#!/reference/api/rome/rest/c_TableAPI

You can build\test a solution in a PDI using the Rest API explorer
https://yourInstance.service-now.com/nav_to.do?uri=%2F$restapi.do

it would look something like this using OOB example

https://yourInstance.service-now.com/api/now/table/sc_req_item?sysparm_query=number%3DRITM0000001&sysparm_fields=sys_id

 

View solution in original post

5 REPLIES 5

shloke04
Kilo Patron

Hi,

Are you using scripted Rest API here? If yes and RIT Number is getting passed to you then do a Glide Record on RITM Table and you can find the number as shown below:

var getNumber = request.pathParam.YOUR Parameter Name;

var gr = new GlideRecord('sc_req_item');

gr.addQuery('number',getNumber);

gr.query();

if(gr.next()){

var id = gr.sys_id;

gs.info('sys ID is'  + id);

}

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

 

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke