With Power Pages table permissions, we can secure records and limit what users can see or change in Dataverse. However, the permissions are always tied to the account or contact being associated with a record via a relationship.
There is no way to conditionally grant access to related records, for example, allow people to see a lookup field value only if the record status is approved/completed/whatever you want.
Power Fx Formula fields to the rescue
One alternative we can use is to leverage Power Fx columns for this. For example, we can create a custom column that has a value only when a certain condition is met, and then use this column in our Power Pages view.
Sample column
In this Power Fx column below, I will show a value from the Resolution Category field, only if the support ticket is marked as completed or cancelled:
Why? For example, what if you want internal users on a Model-Driven app to edit records, set the values (let’s say in a draft mode while this record is in a state – Processing), and let the values appear publicly only when they have status completed? This can easily be achieved using the formula above.
Of course, if our custom code was built using Liquid, we could put the same logic before rendering the page.
But when using the Web API and reading records, we cannot trim down records or field values, once one column is enabled and the user has permissions to read its values, they will be able to read the value in any record they have permissions to.
Results
When running a GET request with the web api, with all fields enabled, just to demo the outputs, for a record where the status is completed, we have a value on the “Resolution Category (Public)” field:

For records with other statuses, we have a null value:

Conclusion
Even though we are limited in what we can expose or not via table permissions in Power Pages, with a small trick using a PowerFx Formula column and some creativity, we can overcome that.
However, you should not use * to show all fields on that table on the web api, and instead, explicitly list the fields you want to enable. And enable the Power Fx field instead of the original choice field.
References
Work with Formula Columns – Microsoft Learn
The post PowerFx Formula Columns to overcome some Power Pages table permissions limitations for WebAPI access in Power Pages appeared first on michelcarlo.






