How to get the group id from a user?

How to get the group id from a user?

There seems to be no session ID for user group, like there is for userid and username. Hence, I need to retrieve the groupid from a user within my application. I want to set the value of a session variable (session.userGroupID) to the actual groupid from a user. How to achieve that?

Using the "assign" widget on a screenaction line, I don't seem to have access to the user group data? I mean, knowing the group id I can indeed retrieve all sorts of data from the Group entity, but how do I know what group id the logged in user has? Standard, there are checkrole functions available, but there are no checkgroups functions?

How to do this? Any help appreciated !
Hi Marcel,

You can reference the Group and Group_User system entities and query them using the userid.
Also notice that one user can be in more than one group.

João Rosado
Hi João,

Thanks for responding!
Indeed, I was missing a system reference to the Group_User entity!
Corrected that, and now I am good to go.
I come from a platform where all references are loaded automatically, so wasn't even aware of the need.

Thanks again!

Keep in mind the user can be member of many groups...

Hi Tim,

Yes, that would be your typical behavior. In my case, the app has been designed in that way that the user can (should) belong to only 1 group, so I don't have to deal with the consequences of that typical characteristic.
Thanks for reminding though.
hi ,

i am trying to reference group and group_user entities in my application, but i am seeing error message saying like below.

Required Permission

You are not allowed to use the Entity 'Group'.

Required Permission

You are not allowed to use the Entity 'Group_User'.

what i need to do to avoid these permission issues.


Hi Kiran,

The 'Group' and 'Group_User' are system entities and require special permissions on the environment you are trying to deploy the application.

Can you ask someone that has permissions to deploy any applications on your environment to deploy your application?

hi Lucio,

one quick question.

usually my manager had admin preveleges, so do i need to contact him and could you please provide me osme steps what he needs to do from his end.

as we are very new, we need some steps that might solve problem easily.

Hi Kiran,

If you only need to reference the Group and the Group_User entities then you can ask you manager to do this for you. He can do this to login in Service Studio and open the eSpace you are working in and try the same thing you already did.

If you're going to do stuff like CreateUser (insert, update or delete data)  keep in mind that on runtime there could also be authentication problems. In that case you should grant the current user admin rights and revoke them before the end of the action. If your just querying thru the data then you should be fine just getting the reference.

Good Luck!