microsoft / PowerApps-Samples

Sample code for Power Apps, including Dataverse, model-driven apps, canvas apps, Power Apps component framework, portals, and AI Builder.

Home Page:https://docs.microsoft.com/powerapps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PowerApps Editable Grid Customizer Control. Correct way to determine entity?

nstratton-srx opened this issue · comments

I'd like to create a common customizer that disables fields for different entities, therefore I need to determine which entity the customizer is being called for.

The context variable is passed into the init method for the customizer control and I can find the entity name in there but the first one belongs to a method with an underscore prefix. That seems a bit scary to rely on.

context.factory._customControlProperties.descriptor.Parameters.TargetEntityType

If I look for my table name in the context object there are almost 900 instances of it, so I suspect there is a better way to get the name of the entity. What should I use?

+1
There are some other use cases where we need to know which entity is the current one.
Using a list of field names (attributes) is not enough. Sometimes the same attribute names are defined for more tables.
This applies also for nested grids (the nested grid can have the same attribute names as the main one), but doesn't have to behave the same.

@nstratton-srx If your question is about a specific sample in this repo, please identify the sample.

Unfortunately, we're unable to handle Support requests for the product here. To contact Support, see here: https://powerapps.microsoft.com/support/.