how to get the RITM sys_id from req sys_id ? which table to look up from ?

chercm
Mega Sage

how to get the RITM sys_id from req sys_id ? which table to look up from ? 

the goal is to get the sctask number from req number 

1 ACCEPTED SOLUTION

Hi,

If you have Request Number then you can use it like below:

Screenshot 2023-12-26 at 5.19.16 PM.png

 

use sysparm_query :

request_item.request.number=REQ0000xxx

 

View solution in original post

12 REPLIES 12

Anil Lande
Kilo Patron

Hi,

If your query is to get SCTASK then you can try below:

 

var requestID = '6eed229047801200e0ef563dbb9a71c2'; // sys_id of request
var scTask = new GlideRecord('sc_task');
scTask.addQuery('request_item.request',requestID);
scTask.query();
while(scTask.next()){
gs.info('SCTASK number : '+scTask.number);
}

 

 

Anil Lande
Kilo Patron

If you want RITM numbers for the request then use below:

 

var requestID = '6eed229047801200e0ef563dbb9a71c2'; // sys_id of request
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request' , requestID);
ritm.query();
while(ritm.next()){
gs.info('RITM number : '+ritm.number);
}

 

@Anil Lande  @Shruti Khaire  how can i use rest API do that ?

Can you please explain what is your requirement and what you have done so far? Where exactly you are facing issue.