Announcements
Hi to all!
I would like to know how I can query if the current user has create/update privileges on the current record.
So an update button (within the PCF component) may be shown or not.
Feels basic, but I'm new into this 🙂
Thanks a lot!
Elowy.
In Client script, that would be formContext.getAttribute(arg).getUserPrivilege()
In a PCF, it is context.utils.hasEntityPrivilege(entityTypeName, privilegeType, privilegeDepth)
Thanks for your response, Cchannon!
If I just want to check if a user has write access to (for example) an account record with an owner. What should I use for privilegeDepth? Or isn't that as simple as one statement and do I have to check all depths?
Well, it depends on your security model and the roles available. If your users only ever have BU level privs or no privs, then there is no reason to check if they have Global. That said, yeah, unfortunately there is no direct api implementation in PCFs for RetrievePrincipalAccessRequest.
Your only alternative is to create the Dataverse Web API request yourself and send it, which is absolutely do-able, just a fair bit more work. Also worth noting, the WebApi.execute() function does exist, it just isn't documented by Microsoft so if you're comfortable with an unsupported approach, you can get to the RetrievePrincipalAccessRequest very quickly that way.
Thanks again!
So if I use hasEntityPrivilege for the Account entity to check whether the user has write access, the condition will be something like:
- ( hasEntityPrivilege (Write, Global) ) or
- ( ( hasEntityPrivilege (Write, Deep) or hasEntityPrivilege (Write, Local) ) and user.BU is record.BU ) or
- ( hasEntityPrivilege (Write,Basic) and ( user == record.owner or user.team == record.owner ) )
Regards,
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 545 Most Valuable Professional
Haque 314
Kalathiya 234 Super User 2026 Season 1