Hello,
I am new to the power apps, I am able to filter the gallery based on user logged in as per below:
App.OnStart – Set(varUser, User());
App.Items - Filter(‘TestSharePointList’, Email = varUser.Email);
However, how can we show all the records of the gallery to Admin along with above?
Please help!
Thanks
Anmol
Solved! Go to Solution.
Hi there @powerappsrooki
First of all welcome to the #PowerAddicts family 😊
If you want to show Records to "Normal users" and "Admins", you will have to set those users somewhere.
Here are some options:
As a quick fix I suggest you use a SharePoint List to configure who are the Admins. Nevertheless, if you need a more robust and secure fix, use O365 Groups (the better practice)
Using a SharePoint List you just need to add a collumn of type "Person or Group " (lets call it "User") in that list (lets now called it "PowerAppAdmins") and insert the users you want to.
On the PowerApp side, you can then use this:
On the OnStart
If(
IsBlank(LookUp('PowerAppAdmins', ThisRecord.User.Email = varUser)),
Set(
Admin,
false
),
Set(
Admin,
false
)
)
On the Items
If(
Admin,
TestSharePointList,
Filter(‘TestSharePointList’, Email = varUser.Email);
)
This way you have two account types, the Admin one, who needs to be listed in the SharePoint List called "PowerAppAdmins" and the default user type, who can only see his records.
Let me know if this worked out for you 😀
App doesn't have an Items property, Do you mean Gallery control Items property?
//pseudo formula, modify as needed
If
(
,LookUp(SomeUserStatusList, Email = varUser.Email).SomeStatusColumn = "Admin"
,'TestSharePointList'
,Filter('TestSharePointList', Email = varUser.Email)
)
Does it help @powerappsrooki ? You may need to modify above as appropriate.
Hi there @powerappsrooki
First of all welcome to the #PowerAddicts family 😊
If you want to show Records to "Normal users" and "Admins", you will have to set those users somewhere.
Here are some options:
As a quick fix I suggest you use a SharePoint List to configure who are the Admins. Nevertheless, if you need a more robust and secure fix, use O365 Groups (the better practice)
Using a SharePoint List you just need to add a collumn of type "Person or Group " (lets call it "User") in that list (lets now called it "PowerAppAdmins") and insert the users you want to.
On the PowerApp side, you can then use this:
On the OnStart
If(
IsBlank(LookUp('PowerAppAdmins', ThisRecord.User.Email = varUser)),
Set(
Admin,
false
),
Set(
Admin,
false
)
)
On the Items
If(
Admin,
TestSharePointList,
Filter(‘TestSharePointList’, Email = varUser.Email);
)
This way you have two account types, the Admin one, who needs to be listed in the SharePoint List called "PowerAppAdmins" and the default user type, who can only see his records.
Let me know if this worked out for you 😀
@Feiteira After I checked your response, I also modified my formula to be more correct, I noticed it was not initially until now.
However, the modifications @powerappsrooki has to make to my pseudo-formula I gave, might need to be the ones you described in more detail, so thank you for providing the additional details @Feiteira .
Thank you @poweractivate , much apreciated coming from you 😀
Now lets see if our buddy @powerappsrooki can get it to work like that 😋
User | Count |
---|---|
126 | |
87 | |
85 | |
75 | |
69 |
User | Count |
---|---|
215 | |
180 | |
139 | |
97 | |
83 |