
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 11:39 PM
Hello Everyone,
I have a requirement whenever i select a category of "Network" in incident table i must auto-populate 2 users name like user#1 , user#2 in watch list
Please help me out how to achieve this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 12:19 AM
Hi Abdul, IN client script use
var a = "sys_idof user1" + ","+ "sys_id of user 2";
g_form.setValue("watch_list", a)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 11:46 PM
Write a before update BR in which validate the condition of Category changes to Network and in script
var watchlist = "user1sys_id" +","+"user2_sys_id";
current.watchlist = watchlist

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 11:57 PM
Sneha,
I need to do it using Client Script:
I tried with below script but it is hittin an error can you please help me out what wrong i am doing:
onchange: Field Name:CAtegory
var cat = g_form.getValue('category');
alert (cat);
var us2 = new GlideRecord('sys_user');
us2.addQuery('user_name',natasha.ingram);
us2.query();
if (cat == 'network')
{
g_form.setValue('watch_list', us2);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 12:02 AM
if(newValue == 'network'){
var us2 = new GlideRecord('sys_user');
us2.addQuery('user_name','natasha.ingram');
us2.query();
if(us2.next()){
g_form.setValue('watch_list', us2.sys_id);
}
See if this helps you.
Please note as per Best Practice you should not use GlideRecord in Client script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2017 12:12 AM
Thanks for the info Sneha,
Its working with your above script but how to add 2 users ?
And i tried with your BR but its not working