web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Answered

Permissions issues

(0) ShareShare
ReportReport
Posted on by 110

I have an evaluation app. I was assisted by a user here in building it and since its taken off. I am having some permission issues. 

 

Powerapps "on start" 

I set variables, collections and filter data based on the user's role (tabs 1-4 super) 1-5 (admin)

 

 

Set(
 gblAdmin,
 LookUp(
 'Control Admin List',
 Title = User().Email
 ).Role = "Admin"
);
Set(
 gblSuper,
 LookUp(
 'Control Admin List',
 Title = User().Email
 ).Role = "Supervisor"
);
ClearCollect(
 colTabs,
 Table(
 If(
 Or(
 gblAdmin,
 gblSuper
 ),
 {
 Value: 1,
 Item: "Safety"
 }
 ),
 {
 Value: 2,
 Item: "Employee"
 },
 {
 Value: 3,
 Item: "Employee Comments"
 },
 {
 Value: 4,
 Item: "Manager Comments"
 },
 If(
 gblAdmin,
 {
 Value: 5,
 Item: "HR Functions"
 }
 )
 )
);
If(
 gblSuper,
 ClearCollect(
 colDirectReports,
 Filter(
 'Employee Evaluations',
 DirectSupervisor1.Email = User().Email
 )
 ),
 ClearCollect(
 colDirectReports,
 'Employee Evaluations'
 )
)

this results in an error and all data disappears. 

 

 

 

 

 
Attempting to lock this down further by forcing the "super" to only see entries based on the collection of direct reports defined. 

  • This code is checking if the user has the role of Supervisor (gblSuper is true).
  • If the user is a Supervisor, it clears and collects data into colDirectReports by filtering the 'Employee Evaluations' based on the condition DirectSupervisor1.Email = User().Email.
  • If the user is not a Supervisor, it clears and collects data into colDirectReports directly from 'Employee Evaluations'.

The app still writes the correct data to the sharepoint repo, but this section is not working and the defined "super"'s can still view entries in which are not their "direct reports" 


There is a gallery that displays this information called galNames. Its "item" property is 

With(
 {
 wData: Filter(
 Sort(
 'Employee Evaluations',
 'Todays Date',
 SortOrder.Descending
 ),
 (Len(cbFindNameI.Selected.Value) = 0 || 'Employee Name' = cbFindNameI.Selected.Value)
 )
 },
 ForAll(
 Sequence(CountRows(wData)),
 Patch(
 Index(
 wData,
 Value
 ),
 {RowNo: Value}
 )
 )
)

This code performs a series of operations on a collection named 'Employee Evaluations'. Here's what each part does:

With({...}): This function allows you to create a temporary context or scope in which you define variables. In this case, it creates a variable wData that holds the result of a series of operations.

wData: Filter(...): Within the With function, a variable wData is created. It is assigned the result of filtering the 'Employee Evaluations' collection.

Filter(...): This function filters a collection based on a given condition. In this case, it filters 'Employee Evaluations'. The filtering condition is defined by the condition inside the Filter function.
Sort(...): This function sorts a collection based on a specified field and sort order. In this case, it sorts 'Employee Evaluations' by the field 'Todays Date' in descending order.

ForAll(...): This function iterates over a sequence of numbers generated by Sequence(CountRows(wData)). It iterates CountRows(wData) times, where wData is the filtered and sorted collection. Each iteration generates a value Value starting from 1.

Patch(...): This function is used to update one or more properties of a record in a collection. It is applied to the item at index Value in the wData collection.

Index(...): This function retrieves an item from a collection at a specified index. In this case, it retrieves the item at index Value from the wData collection.

{RowNo: Value}: This is the data that will be patched into the record. It assigns the property RowNo with the value of Value.

In summary, this code sorts and filters the 'Employee Evaluations' collection based on certain conditions (involving the cbFindNameI.Selected.Value), and then iterates over the filtered data to apply a patch operation, updating the RowNo property of each record with the corresponding iteration value.

 

 

I've tried this on the gallery "item' 

If(
 CountRows(
 Filter(
 'Employee Evaluations',
 DirectSupervisor1.Email = User().Email
 )
 ) > 0 &&
 (gblAdmin || gblSuper),
 With(
 {
 wData: Filter(
 Sort(
 Filter(
 'Employee Evaluations',
 DirectSupervisor1.Email = User().Email
 ),
 'Todays Date',
 SortOrder.Descending
 ),
 (Len(cbFindNameI.Selected.Value) = 0 || 'Employee Name' = cbFindNameI.Selected.Value)
 )
 },
 ForAll(
 Sequence(CountRows(wData)),
 Patch(
 Index(
 wData,
 Value
 ),
 {RowNo: Value}
 )
 )
 )
)

Results in an error - unable to retrieve data 


Categories:
  • BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @jamesmdc1 ,

     

    Looking at your formula, I don't see anything out of the ordinary. Can you please share how supers can view the evaluations? Perhaps it's in a gallery that still references the data source in its' Items property, instead of the colDirectReports collection.

  • jamesmdc1 Profile Picture
    110 on at

    I have edited my post to include the "item" property of the gallery 

    With(
     {
     wData: Filter(
     Sort(
     'Employee Evaluations',
     'Todays Date',
     SortOrder.Descending
     ),
     (Len(cbFindNameI.Selected.Value) = 0 || 'Employee Name' = cbFindNameI.Selected.Value)
     )
     },
     ForAll(
     Sequence(CountRows(wData)),
     Patch(
     Index(
     wData,
     Value
     ),
     {RowNo: Value}
     )
     )
    )

     

    Ive tried several versions of code here such as (SPOILER - None of the below work)

    If(
     CountRows(
     Filter(
     'Employee Evaluations',
     DirectSupervisor1.Email = User().Email
     )
     ) > 0,
     If(
     gblAdmin || gblSuper,
     With(
     {
     wData: Filter(
     Sort(
     Filter(
     'Employee Evaluations',
     DirectSupervisor1.Email = User().Email
     ),
     'Todays Date',
     SortOrder.Descending
     ),
     (Len(cbFindNameI.Selected.Value) = 0 || 'Employee Name' = cbFindNameI.Selected.Value)
     )
     },
     ForAll(
     Sequence(CountRows(wData)),
     Patch(
     Index(
     wData,
     Value
     ),
     {RowNo: Value}
     )
     )
     )
     )
    )
    
    ///THIS DOES NOT WORK
    
    If(
     CountRows(
     Filter(
     'Employee Evaluations',
     DirectSupervisor1.Email = User().Email
     )
     ) > 0,
     If(
     gblAdmin || gblSuper,
     With(
     {
     wData: Filter(
     Sort(
     Filter(
     'Employee Evaluations',
     DirectSupervisor1.Email = User().Email
     ),
     'Todays Date',
     SortOrder.Descending
     ),
     (Len(cbFindNameI.Selected.Value) = 0 || 'Employee Name' = cbFindNameI.Selected.Value)
     )
     },
     ForAll(
     Sequence(CountRows(wData)),
     Patch(
     Index(
     wData,
     Value
     ),
     {RowNo: Value}
     )
     )
     )
     )
    )
    //// ALSO DOES NOT WORK////
    
    If(
     gblAdmin || gblSuper, // If gblAdmin is true or gblSuper is true
     With(
     {
     wData: Filter(
     Sort(
     'Employee Evaluations',
     'Todays Date',
     SortOrder.Descending
     ),
     (Len(cbFindNameI.Selected.Value) = 0 || 'Employee Name' = cbFindNameI.Selected.Value)
     )
     },
     ForAll(
     Sequence(CountRows(wData)),
     Patch(
     Index(
     wData,
     Value
     ),
     {RowNo: Value}
     )
     )
     ),
     Collect(colDirectReports, {}) // Collect an empty collection for gblSuper if neither is true
    )
    
    ////ALSO DOES NOT WORK////

     

  • Verified answer
    BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @jamesmdc1 ,

     

    I see you are indeed referencing the data source instead of the collection in your formula. Please try:

    With(
     {
     wData: Filter(
     Sort(
     colDirectReports,
     'Todays Date',
     SortOrder.Descending
     ),
     (Len(cbFindNameI.Selected.Value) = 0 || 'Employee Name' = cbFindNameI.Selected.Value)
     )
     },
     ForAll(
     Sequence(CountRows(wData)),
     Patch(
     Index(
     wData,
     Value
     ),
     {RowNo: Value}
     )
     )
    )

     

     

  • jamesmdc1 Profile Picture
    110 on at

    Thanks. I was able to take it from there. I do have another question.  A sharepoint column that is a person/group. On default "ThisItem.DirectSupervisor1.email" works, but when the column is deleted and added as a person (multiple selections) - the field in the app breaks 

     

    Ive tried an assortment of options 

    Concat(ThisItem.DirectSupervisor1, Email & "; ")
    ThisItem.DirectSupervisor1.displaynames

     

     

  • BCBuizer Profile Picture
    22,899 Super User 2026 Season 2 on at

    Hi @jamesmdc1 ,

     

    Can you please open a new topic for this new question? Like that it will be easier for other community members to find solutions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard