getMyGroups() function is giving sys_id rather than name of the group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 06:12 AM
Hello Everyone,
Hope you all are doing good !!
I wrote a "before" business rule to insert group name of logged in user, who submitting the form.
So, all records which belongs to their logged in user's group.
Code of business rule is given below:
gs.info("Group name is : " + groupnames);
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 06:20 AM
Hi,
That's what getMyGroups is supposed to do. it returns an array of sys_ids and is commonly used in filters.
If you want an array of names you can write your own version of the same script.
function getMyGroupNames() {
var answer = [];
var sugrm = new GlideRecord('sys_user_grmember');
sugrm.addQuery('user', gs.getUserID());
sugrm.query();
while (sugrm.next()) {
answer.push(sugrm.group.getDisplayValue());
}
return answer;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2018 11:42 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2018 06:07 AM
Hi Anu,
Time to back up and ask the basic question... "What are you trying to do?" In other words, what's the underlying business requirement behind this business rule. I can offer the best technical solution when I understand the problem that we're trying to solve. Please help me understand and perhaps we can work through this with the script (or another solution) to your problem.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2018 11:20 AM
Hi Chuck,
I have created a table (screenshot given below). And the form will submitted by members of 2 groups. Group member of both group is submitting the form. So, I need to insert the group in a database...of the current group member who is submitting the form.
Group name field is a reference field of group table. I don't need to insert in a form. Just I need to insert group name in a database. So that, I tried for business rule which is not working .
So, please help me to get it.
Thanks,
Anu