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

watch_list field in the RITM stores only sys_id of user records not any email id.So while setting value to this field you have to pass sys_id of users record.



So you need to make u_watch_list field in the call table reference to sys_user table.



If u_watch_list is a string type field and contains email address   then in the business rule 1st Glide query to sys_user table and find the sys_id of the users record that contains this email address.



Then set that sys_id in the watch_list of RITM form.



If the the email address is not present in any users record in sys_user table then it will not set in watch_list field of RITM.




Thanks,


Mihir


FYI: watch_list can store email address too.


1.PNG


Petter,




      It should copy everything including the users and email address. The code I gave is fully tested and it works. I think you must be missing something here.


And when you are dealing with reference fields, use getValue() insteda of just saying current.request; use current.getValue("request");


Abhinay Erra
Giga Sage

Did you get this working? Let me know if you have any questions.