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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue PCF-control in P...
Power Apps
Answered

Issue PCF-control in Portal/PowerPages with hasEntityPrivilege

(0) ShareShare
ReportReport
Posted on by 43

In a dataset PCF-control I need to check the create/update/delete privileges of the user on a specific entity.

For this I use this code:

 

const canCreate = context.utils.hasEntityPrivilege("account", 1, 0);
const canUpdate = context.utils.hasEntityPrivilege("account", 3, 0);
const canDelete = context.utils.hasEntityPrivilege("account", 4, 0);


In PowerApps this works fine, but in Portal/PowerPages I get the error "PCFNonImplementedError: hasEntityPrivilege: Method not implemented."

 

How to get the entity privileges of the user within a PCF-control on Portal/PowerPages?

And what is the best way in a PCF-control to check if it's in Portal/PowerPages or PowerApps? (checking if the browser-url ends with .dynamics.com?)

I have the same question (0)
  • Verified answer
    OOlashyn Profile Picture
    3,496 Most Valuable Professional on at

    hi @Ctse,

    So unfortunately not all features from PCF exist in Pages. But there is a way to check it in Power Pages (but you would need to do it outside of the control in you web template and this check only applies to the current record not table overall) - you would need to use table permission https://learn.microsoft.com/en-us/power-apps/maker/portals/liquid/liquid-objects#table-permissions

    // get account record by id
    {% assign account = entities.account['936DA01F-9ABD-4d9d-80C7-02AF85C822A8'] %}
    {% if account.permissions.can_create %}
    // user can create
    <script>
    window.tablePermissions.canCreate = true;
    </script>
    {% endif %}
    {% if account.permissions.can_write%}
    // user can edit
    <script>
    window.tablePermissions.canUpdate = true;
    </script>
    {% endif %}

    Because you will be performing those outside the pcf components one of the easiest ways is to add it to some custom object under the window. You can also use that window object to test if you run inside Power Pages as there is no explicit way to check it out.

  • Ctse Profile Picture
    43 on at

    Hi OOlashyn,

     

    Many thanks for the workaround.

    For some scenarios this can work, but unfortunately I think this will not work in my scenario because then I need a recordid of an existing record where the current uer has read-access for. If the current user does not have any records and the pcf-control needs to know if the user can create a new record then there is no recordid to use for this.

    I hope MS will add soon a more decent generic mechanism to check the entity privileges inside a pcf-control/code component which works also in Portal/PowerPages.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 301 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 297 Most Valuable Professional

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 195

Last 30 days Overall leaderboard