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

Multiple Users Lookup?

Hey all, I am adding a column to my entity...sort of like a 'contributor' column, which will control row-level permissions to items within the entity. I haven't found a way to create a field within the entity that allows you to select multiple users, only one user.

 

Does anyone know how to add a field that supports multiple users?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @mseto ,

Could you please share a bit more about your scenario?

Do you want to add a field in your CDS Entity to allow multiple users selection?

 

If your data source is a CDS Entity, and you want to add a field in your CDS Entity to allow multiple users selection, I afraid that there is no way to achieve your needs in PowerApps currently.

 

Currently, within PowerApps, there is no field type supported in CDS Entity to allow multiple users selection. If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, I agree with @eka24 's thought almost. You could consider add a Option Set Type column called "Role" in your CDS Entity (the "Roles" field reference values from the Option Set called "Roles"), use it to store the required role level for each record. This Option Set type column should have the following available options:

User
Admin

Then you could create another CDS Entity (called "Contributors"), within this Entity, store the detail info of these end users who would run your canvas app. This Entity should contains User Name, Email, RoleType, ... etc. The RoleType is also a Option Set Type column, which reference values from same Option Set as the "Role" column in your main Entity.

 

Within your app, add above new created Entity as data source. Set the OnStart property of the App to following:

Set(
    CurrentUserRole, 
    LookUp(Contributors, Email = User().Email).RoleType
)

 

Set the Items property of the Gallery to following:

Filter(
       'Your Main Entity',
       If(
          CurrentUserRole = Roles.Admin,
          true,
          Role = CurrentUserRole
       )
)

Please consider take a try with above solution, then re-load your app (fire the OnStart property of App), check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
eka24
Super User
Super User

One way of going around it is to have a GroupColumn in the Table.Th GroupColumn will consist of many users:
user.JPG

Thus you can filter or do the row level security based on the GroupColumn.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

That's a great workaround, but let me ask you this. What if you wanted some users to be able to edit their own entity values but not others? The User/Admin concept is all or nothing. I have entity values where I want the people responsible for the data within those values to be able to edit them, but not other users entity values.

That is doable. For example these would be the formula for each in filtering example a Gallery:
  By GroupColumn (All group members will see data)

      Filter(Datasource,GroupColumn=TextBox1.Text)

 

By Specific User (Only User Will see his / her record)

    Filter(Datasource,Email=User().Email)

 

Where Textbox1 will be a lookup: LooUp(UserTable,Email=User().Email,GroupColumn)

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

v-xida-msft
Community Support
Community Support

Hi @mseto ,

Could you please share a bit more about your scenario?

Do you want to add a field in your CDS Entity to allow multiple users selection?

 

If your data source is a CDS Entity, and you want to add a field in your CDS Entity to allow multiple users selection, I afraid that there is no way to achieve your needs in PowerApps currently.

 

Currently, within PowerApps, there is no field type supported in CDS Entity to allow multiple users selection. If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, I agree with @eka24 's thought almost. You could consider add a Option Set Type column called "Role" in your CDS Entity (the "Roles" field reference values from the Option Set called "Roles"), use it to store the required role level for each record. This Option Set type column should have the following available options:

User
Admin

Then you could create another CDS Entity (called "Contributors"), within this Entity, store the detail info of these end users who would run your canvas app. This Entity should contains User Name, Email, RoleType, ... etc. The RoleType is also a Option Set Type column, which reference values from same Option Set as the "Role" column in your main Entity.

 

Within your app, add above new created Entity as data source. Set the OnStart property of the App to following:

Set(
    CurrentUserRole, 
    LookUp(Contributors, Email = User().Email).RoleType
)

 

Set the Items property of the Gallery to following:

Filter(
       'Your Main Entity',
       If(
          CurrentUserRole = Roles.Admin,
          true,
          Role = CurrentUserRole
       )
)

Please consider take a try with above solution, then re-load your app (fire the OnStart property of App), check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,479)