Filter for group dropdown in On-call rotation calendar module
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2010 08:33 AM
We are trying to filter the group dropdown list in the on-call rotation calendar module so that the current logged on user only sees groups where they are the manager or a member. Currently, we have hundreds of groups wanting to use the on-call rotation functionality and this group dropdown list is going to become non-user friendly unless we filter it.
I've been given suggestions to use a reference qualifier or to use access control rules to limit which groups show in this list. The problem is that I don't want to limit which groups a person can see globally. I just want the list limited in the on-call rotation calendar module.
In trying to find where the code is that creates the content for this list, I found the "schedule page" named "group roster" where it appears that this calendar and group dropdown are being generated. I'm not quite sure how to modify this code though. If anyone has a tip on how to accomplish what I'm trying to do it would be much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2010 12:01 PM
After more research, I was able to accomplish a filter by customizing the "Group Rosters" schedule page HTML. I modified the following chunk of code:
if (groupIds.length > 0) {
rotaGR = null;
var u = gs.getUserID();
var groupGR = new GlideRecord('sys_user_group');
groupGR.addQuery('sys_id', groupIds);
groupGR.orderBy('name');
groupGR.query();
}
to be:
if (groupIds.length > 0) {
rotaGR = null;
var u = gs.getUserID();
var groupGR = new GlideRecord('sys_user_group');
groupGR.addQuery('sys_id', groupIds);
var qc = groupGR.addQuery('sys_id', 'javascript:getMyGroups()');
qc.addOrCondition('manager', u);
groupGR.orderBy('name');
groupGR.query();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2011 02:27 PM
Just to add to the solution, here is a quick change to filter the list to groups that belong to the business unit of the current logged in user. Since our instance technically has 80+ business unit (locations), we don't want a user from Location A to modify a schedule from Location B. This allows the user full access to change schedules within their business unit, but not another location. The downfall too though is the user can't see schedules outside their business unit (not an issue for us).
var groupIds = [];
var rotaGR = new GlideRecord('cmn_rota');
rotaGR.addActiveQuery();
rotaGR.query();
while (rotaGR.next()) {
groupIds.push(rotaGR.group + '');
}
if (groupIds.length > 0) {
rotaGR = null;
var groupGR = new GlideRecord('sys_user_group');
groupGR.addQuery('sys_id', groupIds);
groupGR.addQuery('u_business_unit', 'javascript:gs.getUser().getCompanyID()');
groupGR.orderBy('name');
groupGR.query();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2012 07:01 AM
I have been looking for this functionality for a while, and this works perfectly. Thank you for posting.
Is there a way to tie "role" into this? I would like the admins to see all of the calendars if possible.
Thanks again for the post!
Jason
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-09-2013 11:40 AM
This is exactly what I been looking for, but haven't been able to find the pages listed. Where can the "Group Rosters schedule page HTML" be found.
All I have been able to find are a few, unrelated, script includes.