How to get the RITM number from the Catalog Task in Business Rule

ursnani
Giga Guru

HI,

I have a business rule in place on sc_task table and now I want to send the RITM Number that is present in TASK.

Currently i am using current.request_item.getDisplayValue(); But its not sending the RITM numebr instead its sending the TASK number.

Can anyone please help me.

find_real_file.png

1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

Hello,



You need to do GlideRecord on sc_req_item table to get the RITM #. sample code like below should help you.



(function executeRule(current, previous /*null when async*/) {


var gr = new GlideRecord('sc_req_item');


gr.addQuery('sys_id', current.request_item);


gr.query();


if(gr.next())


{


current.u_request_number = gr.number;


}


})(current, previous);


View solution in original post

8 REPLIES 8

Shishir Srivast
Mega Sage

Hello,



You need to do GlideRecord on sc_req_item table to get the RITM #. sample code like below should help you.



(function executeRule(current, previous /*null when async*/) {


var gr = new GlideRecord('sc_req_item');


gr.addQuery('sys_id', current.request_item);


gr.query();


if(gr.next())


{


current.u_request_number = gr.number;


}


})(current, previous);


HI,



yeah I did



var gr = new GlideRecord('sc_req_item');


      gr.addQuery('sys_id',current.request_item);


      gr.query();


      while(gr.next())


              { ritm_sys_id = gr.sys_id;


}



and then


var ga = current.request_item.getDisplayValue();



But i am not getting the RITM NUMBER.


i am getting the TASK NUMBER


this is wrong ritm_sys_id = gr.sys_id; what is ritm_sys_id.


also, you can get the RITM number using number instead of sys_id.


so if i use like



var gr = new GlideRecord('sc_req_item');


gr.addQuery('sys_id', current.request_item);


gr.query();


if(gr.next())


{


current.u_request_number = gr.number;


}



var ga = gr.number;



If i pass the number like this will it work.