cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

Filter Drop Down Choices Based on login user group

Hi All,

I have couple of Sharepoint groups and users are been added to the groups. Based on the logged-in user's group I want to add values in to a dropdown called Site Drop down.

eg- Group A, Broup B, Group C

 

Site Drop down items if the loged in user in Group  A -> Item A1, Item A2, Item A3

                                    if the loged in user in Group A and B -> Item A1, Item A2, Item A3, Item B1, Item B2

                                    if the loged in user in Group C -> Item C1, Item C2, Item C3

Can someone please tell me, how can I do this ?

 

Thnaks. 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hello @NewNW,

 

For what you want to do, you have to use the connexion "Office 365 Groups".

You can set:

Application.OnStart = 

Clear(DropdownContent);
If("GroupA" in Office365Groups.ListOwnedGroups().value.displayName, Collect(DropdownContent, "A1", "A2", "A3"));
If("GroupB" in Office365Groups.ListOwnedGroups().value.displayName, Collect(DropdownContent, "B1", "B2"));
If("GroupC" in Office365Groups.ListOwnedGroups().value.displayName, Collect(DropdownContent, "C1", "C2", "C3"))

/!\ Warning : 'Office365Groups' isn't the same syntax depending of your region (for example in France it's 'GroupesOffice365') /!\

 

DropDown.Items =

DropdownContent

Keep me informed 🙂

 

Best regards,

 

Louis

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hello @NewNW,

 

For what you want to do, you have to use the connexion "Office 365 Groups".

You can set:

Application.OnStart = 

Clear(DropdownContent);
If("GroupA" in Office365Groups.ListOwnedGroups().value.displayName, Collect(DropdownContent, "A1", "A2", "A3"));
If("GroupB" in Office365Groups.ListOwnedGroups().value.displayName, Collect(DropdownContent, "B1", "B2"));
If("GroupC" in Office365Groups.ListOwnedGroups().value.displayName, Collect(DropdownContent, "C1", "C2", "C3"))

/!\ Warning : 'Office365Groups' isn't the same syntax depending of your region (for example in France it's 'GroupesOffice365') /!\

 

DropDown.Items =

DropdownContent

Keep me informed 🙂

 

Best regards,

 

Louis

 

View solution in original post

Thanks LouisC.

I cannot use O365 group , it has to be SP group. seems to be currently PowerApps dosent allow that.

 

Thanks.

Anonymous
Not applicable

For me a Sharepoint Group is also a O365Group no ?

Thanks for your input.  I've tried a number of iterations of this and, after a couple of hours, still no success.  Any thoughts?  

 

Clear(' Requests’.'Comment Type');

If(

    "RequestsEveryone Members" in Office365Groups.ListOwnedGroupsV2().value.displayName,

    Collect(

        ‘Requests’.'Comment Type',

        "Note to Supplier"

    )

);

If(

    "RequestsAdmins Members" in Office365Groups.ListOwnedGroupsV2().value.displayName,

    Collect(

        ' Requests’.'Comment Type',

        "Note to Supplier",

        "Internal Note"

    )

)

 

I just created the groups -- does it take time for them to take effect?  I've also tried it without "Members" on the end of the name.  Finally -- does display name refer to matching the name of the individual logged in to the name of the person in the Office 365 group?  

 

This is not creating a collection at all. Everytime I look, there  is nothing there. 

 

Thanks so much!

Anonymous
Not applicable

Hello @CindyZ,

 

Do you have errors in your code ?

And what is your 'Requests'.'CommentType' ? Does it already exist ? Try to create the collection with a single name 'CommentType'.

 

I made a sample of code for you, try with it :

Clear(CommentType);
If(
    "RequestsEveryone Members" in Office365Groups.ListOwnedGroupsV2().value.displayName,
    Collect(
        CommentType,
        "Note to Supplier"
    )
);
If(
    "RequestsAdmins Members" in Office365Groups.ListOwnedGroupsV2().value.displayName,
    Collect(
        CommentType,
        "Note to Supplier",
        "Internal Note"
    )
)

I put again my warning 

/!\ Warning : 'Office365Groups' isn't the same syntax depending of your region (for example in France it's 'GroupesOffice365') /!\

With it, it gives :

Clear(CommentType);
If(
    "RequestsEveryone Members" in GroupesOffice365.ListOwnedGroupsV2().value.displayName,
    Collect(
        CommentType,
        "Note to Supplier"
    )
);
If(
    "RequestsAdmins Members" in GroupesOffice365.ListOwnedGroupsV2().value.displayName,
    Collect(
        CommentType,
        "Note to Supplier",
        "Internal Note"
    )
)

Best regards,

 

Louis

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (15,880)