- 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-12-2017 10:53 PM
Hi Pavan,
Can you please explain , what exact thing have you done? have you changed the reference table or did you create a business rule or a ref qualifier?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2017 11:23 PM
Thank you for help,
1.I have created business rule by using above script( for task table)
2.I will go through service-catalog and create new task then auto populated the users in watch list based on the group or script.
3.In that group some users are locked out.
4.but i need exact requirement is locked out users also showing in watch list. i need only active users in watch list.
5.i have try reference qul is active=true, but its not working.(its working only magnifier)
Thanks,
Pavan
- 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-12-2017 11:59 PM
Hi sanjiv,azim,
I have changed above script its working awesome.
but small help var list[], its showing error. how can modify?
with out var list[] its working good.
Thank you so much
Regards,
Pavan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2017 12:03 AM
I forgot the var list = []; equal to thing, updated the code, check again.