Skip to main content
Known Participant
Oct 4, 2022 5:16 PM UTC
Solved

How to separate out Users and Group which are part of one Main Group in ER

Hi @all,

Is there an easy way to separate out users and groups from a Main Group in an expression rule. 

Below are the users and groups coming from a group itself. I want to separate out users from this list and wants to store it.

Looking forward for your support, Thank you in advance!

    csteward
    cstewardAnswer
    Brainy
    Oct 4, 2022 5:29 PM UTC

    Yes, a!groupMembers() can return only the list of direct, user type members in a group such as:

    a!groupMembers(
      group: cons!YOUR_GROUP_CONSTANT,
      direct: true,
      memberType: "USER"
    )

    4 replies

    harshitb6843
    Brainy
    Oct 4, 2022 5:28 PM UTC

    I think you can convert them into a string and then use the isusernametaken() function. If it returns true, then it is a user else it is a group. 

    maryl0003Author
    Known Participant
    Oct 4, 2022 5:47 PM UTC

    Thanks @Harshit

    csteward
    cstewardAnswer
    Brainy
    Oct 4, 2022 5:29 PM UTC

    Yes, a!groupMembers() can return only the list of direct, user type members in a group such as:

    a!groupMembers(
      group: cons!YOUR_GROUP_CONSTANT,
      direct: true,
      memberType: "USER"
    )

    maryl0003Author
    Known Participant
    Oct 4, 2022 5:48 PM UTC

    Thank you @Chris