Is it possible to retrieve sc_task sys_id value using the sc_req_item sys_id value?

Community Alums
Not applicable

Is it possible to retrieve sc_task sys_id value using the sc_req_item sys_id value?

The desired end result would be to create a client side javascript which redirects to the TASK after creating a service request but for that I would need to retrieve the Tasks unique value by using the sc_req_item (RITM ID value)

The ID should look something similar to this: 0af098d4dbb837004fc75c8a68961997

 

1 ACCEPTED SOLUTION

Abhishek Pidwa
Kilo Guru

Hi Alex,

 

It is definitely possible. The thing to remember is that one sc_req_item (Request Item) can have multiple catalog tasks (sc_task). So you can query the sc_task table to get the sys_ids of sc_task:

 

var gr = new GlideRecord('sc_task');

gr.addQuery('request_item', <sc_req_item Sys ID>);

gr.query();

while (gr.next()) {

 gs.print('Sys Id of sc_task is -->'+gr.sys_id);

}

 

Try this and let me know if you have any questions.

 

Please mark this answer as helpful/correct if this solves your problem

View solution in original post

2 REPLIES 2

Abhishek Pidwa
Kilo Guru

Hi Alex,

 

It is definitely possible. The thing to remember is that one sc_req_item (Request Item) can have multiple catalog tasks (sc_task). So you can query the sc_task table to get the sys_ids of sc_task:

 

var gr = new GlideRecord('sc_task');

gr.addQuery('request_item', <sc_req_item Sys ID>);

gr.query();

while (gr.next()) {

 gs.print('Sys Id of sc_task is -->'+gr.sys_id);

}

 

Try this and let me know if you have any questions.

 

Please mark this answer as helpful/correct if this solves your problem

Community Alums
Not applicable

Thank you Abhishek! This was just what I was looking for 🙂