I am trying to use RecordInfo on a Dataverse table to determine if the user has Delete permissions on a record. It does not seem to return the correct answer when the record ownership has been changed in one application session.
The current record is in a variable called 'currentRecord'. PowerApps correctly evaluates this when the user comes into the app fresh.
The app lets the user submit the record to an approver - upon which the Owner is changed, and the user loses Update/Delete access, as I can confirm using 'Check Access' in a model-driven view of the table (in another app). But RecordInfo keeps saying the user has Delete access.
I've tried refreshing the dataset, and using LookUp to pull in a 'fresh' copy of 'currentRecord' before doing the RecordInfo check - even calling RecordInfo with a LookUp as the first argument. Nothing changes. The user has to exit the app, and re-enter, before the answer is correct.
The inverse also happens: The user can 'Recall' the record, in which case Ownership is transferred back to the user (I use Flows and Process Actions to change the owner on 'Recall'). But RecordInfo will never return 'true' for the 'Delete' permission, unless the user exits and re-enters the app.
Any insight on what PowerApps is actually doing under the covers here?
I've tried Refresh()ing the dataset, ad nauseum. I also tried firing RecordInfo(LookUp('table', id=Gallery1.Selected.id)) so that the first argument to RecordInfo is called with a 'fresh record' straight from the data source.
Based on further testing, it looks like RecordInfo caches results, AND DOES NOT EVER REFRESH THOSE RESULTS, EVEN WHEN THE DATASET IS REFRESHED. It only refreshes with a browser Refresh - i.e., leave the app and come back in.
This makes RecordInfo pretty useless. If someone has an app open all day, and record permissions are changing due to data being updated, they will only see the 'correct' answer for permissions for a given record ONCE - the first time the app calls RecordInfo for that record. After that, the first answer will always be returned.
I can see how Microsoft would have wanted to aggressively cache RecordInfo() results, as many devs will probably tie control Visibility and DisplayMode to RecordInfo permission checks. Resulting in many, many calls to the datasource without caching. But they purposefully left this issue in?
Hi,
My guess is that you haven't done a Refresh(DataSource), so it has the old stuff cached.
Cheers
If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
Thank You
Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
https://gernaeysoftware.com
LinkedIn: https://www.linkedin.com/in/michaelgernaey
WarrenBelz
146,601
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,942
Most Valuable Professional