- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 02:17 PM
I have a record producer that I want to add users to the watch list for the incident that gets created. I can populate the watch list with my name, but it doesn't reference my user object when I go to the incident and view the watch list. The details are blank, which means it's not really me.
The question before the community is this: how can I populate a watch list via server-side record producer script with names of users?
Thank you very much!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 02:42 PM
Hi,
watch_list is an array list so you need to use the push function to insert an entry in an array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2016 03:49 PM
found this off of the GlideRecord - ServiceNow Wiki page. Is this what you were referring to? Except for the getDisplayValue() I would use set?
// list will contain a series of display values separated by a comma
// array will be a javascript array of display values
var list = current.watch_list.setDisplayValue('Will Smith','Clark Kent','Superman');
var array = list.split(",");
for (var i=0; i < array.length; i++) {
gs.print("Display value is: " + array[i]);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2016 05:22 AM
I can't get this to push to the watch_list. Would you mind giving me a hand with the code rahuljain? I read through the correct answer on this thread and modified my code to match and it's not pushing. Adding users to watch list during a workflow based on variables entered by user.
var watch_list_conversion_users = ['Will Smith','Clark Kent','John Wayne']
watch_list.push(watch_list_conversion_users);