getMyGroups() function is giving sys_id rather than name of the group.

SNOW32
Giga Expert

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:

var groupnames = getMyGroups();
gs.info("Group name is : " + groupnames);
 
When I am checking in System Log ,,I can only see sys_id.
How to retrieve name of the group rather than sys_id.
I tried with gs.info("Group name is : " + groupnames,getDisplayValue()); as well as ("Group name is : " + groupnames,getDisplayValue('name'));
But it showing result as "undefined". 
Please help with it .
Thanks,
Anu
 
5 REPLIES 5

Hi,

The details of your configuration and requirements are a little unclear.

On your form image you have highlighted 'Group name'
If configured as a reference field this would normally allow 1 'group' to be populated into the field
- this appears to be the current configuration.
If you wish to add multiple groups to this field, then you would need to configure 'Group name' as a list rather than reference - similar to a task watch list.

A user may have many groups;
So if you wish to auto-populate a reference field with 1 group name via a BR, then you will need to allow for some unique identifier so that the correct group can be selected where a user has multiple groups. You could hard code this, but it would not be a good\flexible solution.

If you just wish to populate one (or multiple) group records name\labels, which appears to be the intention of the BR, then the field type probably just needs to be a string. You can then concatenate your array of names into a string.

If you can clarify\provide clear specific details, and include code that isn’t a screen shot
I am sure someone will be able to assist further.

Regards Tony