- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2019 11:28 AM
I currently have a Catalog Item with a Workflow running against sc_req_item. One of the steps of the worklow is a Run Script action that takes selected users from a Catalog Item variable, and writes them to the Watch List on the sc_req_item, like this:
//Populate Watch List on Requested Item
var notify_list = current.variables.notification_list;
current.watch_list = notify_list;
However, the issue is that most of the Notifications are writing off of sc_request, not sc_req_item. So I actually need my script to update the Watch List field on the parent sc_request record.
Can I do that with simple dot-walking (I always seem to screw up the syntax), or do I need to do Glide Record to update the appropriate sc_request record?
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2019 12:14 PM
OK, it worked when I did it as a GlideRecord like this:
var notify_list = current.variables.notification_list;
var recnum = current.request.number;
var gr2 = new GlideRecord('sc_request');
gr2.addQuery('number', recnum);
gr2.query();
if(gr2.next()){
gr2.watch_list = notify_list;
gr2.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2019 11:40 AM
Hi,
Just update the script as below and it should work:
//Populate Watch List on Requested Item
var notify_list = current.variables.notification_list;
current.request.watch_list = notify_list;
Kindly mark my answer as correct/helpful if I was able to help you.
Regards,
Alok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2019 12:03 PM
That does not appear to be working. Just to make sure, I added another line to update another field on the Request (Description), and that did not work either.
Perhaps a Request cannot be updated in this manner from Workflow that is running against Requested Item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2019 12:14 PM
OK, it worked when I did it as a GlideRecord like this:
var notify_list = current.variables.notification_list;
var recnum = current.request.number;
var gr2 = new GlideRecord('sc_request');
gr2.addQuery('number', recnum);
gr2.query();
if(gr2.next()){
gr2.watch_list = notify_list;
gr2.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2019 12:26 PM
That's great...!!!
Apology for the incorrect suggestion, Also, I would like to let you know that updating the record of other table by using dot working is not possible. you can only get the values by using dot work. To set the value on other table you need to use glide record.