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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / In PA editable grid co...
Power Apps
Answered

In PA editable grid control, index.ts init method, trying to get primaryImageAttribute from context.utils.getEntityMetadata(entityName), which returns primaryImageAttribute as a promise

(0) ShareShare
ReportReport
Posted on by 203

I need to get primaryImageAttribute from the Entity Metadata.

 

I'm wanting to render the primary image column in the grid cell in the CellRendererOverrides.tsx generateCellRendererOverrides function. My generateCellRendererOverrides function works fine ...

 

LozzieD_0-1671450493798.png

 

Now, context.utils.getEntityMetadata(entityName) returns a promise of the EntityMetadata. Here it is in my index.ts init method ...

 

LozzieD_2-1671451178999.png

 

When the EntityMetadata promise appears, the const variable primaryImageAttribute will be set to the primaryImageAttribue returned in the EntityMetadata promise.

 

So, to wait for the EntityMetadata promise and primaryImageAttribute to appear, I've wrapped async around an anonymous function and put await on the primaryImageAttribute variable.

 

There's no red squigglies in CellRendererOverrides.tsx or index.ts.

 

The Dev Tools debugger runs up to "return myValue" in the success function returned by "getMetadata(entityName).then( ..." that supplies the value for my primaryImageAttribute variable ...

 

LozzieD_3-1671451847060.png

And then no further breakpoints are hit.  It just disappears.

 

Any ideas?

 

Or, my handling of the promise / async may be wrong or just simply not destined to work.  If so, is there some non-promise, actual synchronous value, way of getting the primaryImageColumn value from the Entity Metadata?

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

    Hi @LozzieD , 

     

    Instead of wrapping the async around the anonymous function, register the even right inside your metadata success function.

    DianaBirkelbach_0-1671474199898.png

    I've done the same inside this PAGrid PCF. Have a look: https://github.com/brasov2de/GridCustomizerControl/blob/main/CellRenderer/DianaGridCustomizerControl/index.ts

     

    Maybe my blog might help too: https://dianabirkelbach.wordpress.com/2022/07/27/power-apps-grid-control-first-glimpse-to-the-cell-renderer-and-editors/

     

     

  • LozzieD Profile Picture
    203 on at

    By George and all the Saints, you nailed it Diana! Thank you!

     

    Can't tell you how long I've laboured over that one as a newbie to the TypeScript, React, Fluent-UI, PCF "stack" above plain old JavaScript. Trying to over-complicate the async goings-on.

     

    I've got my "PowerApps Editable Grid with image column rendered in a cell" project working now ...

     

    LozzieD_0-1671537090088.png

    Your blog always comes out on top for deep-dive insights when searching for PCF resources.  I can see I need to methodically work through it rather than just pick up on the search hits!  Xmas - New Year project ...

     

    Thanks once again.

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Happy to hear that @LozzieD ! So glad I could help!
    Have fun with your new project! 😉

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 400 Most Valuable Professional

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard