Skip to main content
Known Participant
Jan 11, 2023 4:08 AM UTC
Question

How to get only groups assigned to user?

Hi Everyone,

I am using the script a!groupsForUser(loggedInUser()) to get list of groups assigned to user but it gives the id along with group and I only want group name.

Can anyone please suggest?

    5 replies

    konduruc733182
    Inspiring
    Jan 11, 2023 5:01 AM UTC

    Hello shubhamy0005,

    Please try this code, it works!

    a!forEach(
      items: a!groupsForUser(loggedInUser()),
      expression: group(fv!item,"groupName")
    )

    Known Participant
    Jan 11, 2023 5:16 AM UTC

    Thanks Konduru, This expression gives insuffiicient permission error.

    Participating Frequently
    Jan 11, 2023 5:22 AM UTC

    Hi [mention:9e801b4ea7ba47db8735359b555491e6:e9ed411860ed4f2ba0265705b8793d05], Can you please share the error you are receiving.

    vinays024987
    Inspiring
    Jan 11, 2023 6:01 AM UTC

    You can try this.

    getgroupnames(
      a!groupsForUser(loggedInUser())
    )