- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-04-2017 09:08 AM
Hi ,
i have added two users in watch list using below script but these users are inactive it will showing in watch list still.
Please tell me, if users are inactive how to remove from watch list?
(function onBefore(current, previous)
{
var grpMembers = new GlideRecord("sys_user_grmember");
grpMembers.addQuery("group",current.assignment_group);
grpMembers.query();
while(grpMembers.next())
{
if((current.assignment_group.getDisplayValue() == "Network Engineer") )
{
wL='Jacob Bourdon' + ","+'Shana Sessler' ;
current.watch_list = wL;
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 11:31 PM
Hi Pavan,
Although, im not much in favor of using a BR, but then again if you want to complete it with a script then please use:
//code of sanjiv,modifed
var grpMembers = new GlideRecord("sys_user_grmember");
grpMembers.addQuery("group",current.assignment_group);
grpMembers.addQuery('user.active',true);
var list=[];
grpMembers.query();
while(grpMembers.next())
{
if(current.assignment_group.getDisplayValue() == "Network Engineer") // the group you want only to work
{
list.push(grpMembers.getValue('user'));
}
}
current.watch_list=list; // outside the while
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2017 05:29 AM
Hi sanjiv could you help me another query ?
incident table its not working. please if you know tell me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2017 05:34 AM
Error showing like this : org.mozilla.javascript.NativeArray@dfaa31
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2017 05:49 AM
The only reason is, you are directly accessing the array's object try converting it to string first.
var str= list.toString();
Use, str later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2017 06:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2017 06:34 AM
no, its var list[]; instead of var str=...
then convert to string var str= list.toString(); outside the while loop.
Then you can use current.watch_list=str;