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

if you are looking to get the RITM number then gr.number should work.


HI



thanks Its working As expected


Raghu Loganatha
Kilo Guru

Hello Ursnani,



Can you try using this current.request_item.number; or current.request_item.number.getDisplayValue();

~Raghu.


abhishekdash
ServiceNow Employee
ServiceNow Employee

Hello Ursnani,



I did the same thing and it works for me:



gs.addInfoMessage("The RITM number is:" +current.request_item.getDisplayValue());



Here is the BR and the Information on the SC_TASK:



Screen Shot 2017-07-20 at 4.39.15 PM.png


Screen Shot 2017-07-20 at 4.39.25 PM.png



Can you check on sc_req_item dictionary entries and verify which field has "Display = True"?


That might be one of the reasons for this issue.



Thanks,


Abhishek



If this reply assisted you, please consider marking it Correct, Helpful, or Like it.


This helps other customers to learn from your thread.