How to know which user is related to which specific group.

Hi,
Is there any way to find out that the current user is related to which specific group. I mean to say I create a group that has several users. Now I want to know the current user is related to that group or not.

dundas.context.currentSession.accountDisplayName using this I am able to get current user name.

but how can I check that this user is the member of which group?

Hello @anupam.mishra,

You can try this script:
groupService.getGroupInfosByIds(window.dundas.context.currentSession.groupMembershipIds).done(function (infos) {
console.log($E(infos).select(function (a) { return a.displayName; }).toArray());
});

Hi Costin,

I used this script but I have doubt on the result.

Hi @anupam.mishra,

Please check this post: Get accountName or Username