Set watch list with business rule

petterbj_rgmo
Tera Contributor

Hello all,

We are on Helsinki and using inbound actions with the Service Desk Call plugin. In the inbound action I created I am adding a email address to the watch list on the Call form. When the Call type is set to request, I need the email address on the watch list to be added to the watch list on the request item. So basically I want the email address in the watch list to be added to the RITM when it is created. I have tried doing this with a business rule (after) that runs on insert and is run on the sc_req_item table. The code is as follows:

find_real_file.png

I cannot seem to figure out where I am going wrong. Any ideas?

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Here you go. Use this script. This should be a before business rule



var gr1= new GlideRecord("new_call");


gr1.addQuery("transferred_to",current.getValue("request"));


gr1.query();


if(gr1.next()){


current.watch_list=gr1.u_watch_list;


}


View solution in original post

21 REPLIES 21

jake_mckenna
ServiceNow Employee
ServiceNow Employee

after line 26 i think you need to add the line:



gr1.update();



this will commit you changes to the u_watch_list on the new_call table


Nope, doesn't do the trick



find_real_file.png


ah! maybe i was reading this wrong, but it sounds like you are mapping the caller watch list to the RITM. If this is the case you are going to want to change you business rule to a before rule and your line 26 to:



current.watch_list = gr1.u_watch_list



Let me know how that works.


Abhinay Erra
Giga Sage

Here you go. Use this script. This should be a before business rule



var gr1= new GlideRecord("new_call");


gr1.addQuery("transferred_to",current.getValue("request"));


gr1.query();


if(gr1.next()){


current.watch_list=gr1.u_watch_list;


}