Changing or Creating a new getMyGroups() function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2010 06:36 AM
I was curious to see if anyone had created a new getMyGroups() function and if so how they did so. We are running into issues where we want to get a users groups but we do not want to pull back the parent groups. With the current function it will pull back all of these group. Looking at the business rule where this function resides it would appear that it is calling itself so I can only imagine that it is hard coded.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012 09:12 AM
thank you for the solution and also sharing about using a script include VS using a global business rule!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2012 09:55 AM
i am looking for something similar, but want create a new business rule called getMyDivision. It is not working for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2012 11:08 AM
Have you tried returning this as an array rather than the string value?
function getMyDivision(){
var MyDivision;
var uID = gs.getUserID();
var user = new GlideRecord('sys_user');
user.addQuery('user', uID);
user.query();
while(user.next()){
MyDivision = user.u_division.split(','); //u_division is simply a reference field back to cmn_department
}
return MyDivision;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2012 06:35 AM
Yes, I have tried returning an array of Strings also, this does not work either.
function getMyDivision(){
var DivisionArray = new Array();
var uID = gs.getUserID();
var user = new GlideRecord('sys_user');
user.addQuery('user', uID);
user.query();
while(user.next()){ DivisionArray.push(user.u_division.toString()); }
return DivisionArray;
}
I have also tried returning a "cmn_deparment" variable instead of a String, since that is the reference field's table. This did also not work