PowerApps Component Framework has numerous methods that are useful to developers in several ways. In developing one of my PCF controls, I ran across a case in which entity colors were required in our control.
I obtained this using the conventional method of calling the getEntityMetadata() for the respective entity and obtaining the EntityColor from it.
let metadata = await context.utils.getEntityMetadata("account"); let entityColor = metadata.EntityColor;
However, this leads to sending requests to the CRM as it is asynchronous, which usually degrades the performance of our PCF control.
Solution
In this case, the getEntityColor method comes to the rescue, where no request is sent to CRM. Thus, enhancing the performance of our PCF control. This method can be found in theming under context.
context.theming.getEntityColor(entityName);
Using the above method, we can get the entity color in HEX format as we add them in customizations.
As shown in the below screenshot, we…