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 Platform Community / Forums / Power Apps / Check privileges on cu...
Power Apps
Answered

Check privileges on current record (PCF component Dataverse/MDA)

(0) ShareShare
ReportReport
Posted on by 153

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.

I have the same question (0)
  • cchannon Profile Picture
    4,702 Moderator on at

    In Client script, that would be formContext.getAttribute(arg).getUserPrivilege()

     

    In a PCF, it is context.utils.hasEntityPrivilege(entityTypeName, privilegeType, privilegeDepth)

  • Elowy GrootCRM Profile Picture
    153 on at

    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?

     

  • Verified answer
    cchannon Profile Picture
    4,702 Moderator on at

    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.

  • Elowy GrootCRM Profile Picture
    153 on at

    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,

    Elowy.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 545 Most Valuable Professional

#2
Haque Profile Picture

Haque 314

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard