Get Entity Colors in PowerApps Component Framework

InogicDyn365CE1 year ago8 Views


Introduction

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.

PowerApps

As shown in the below screenshot, we…



Source link

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
February 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28   
« Jan   Mar »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...