Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
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?

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: In PA editable grid control, index.ts init method, trying to get primaryImageAttribute from context.utils.getEntityMetadata(entityName), which returns primaryImageAttribute as a promise

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

  • LozzieD Profile Picture
    203 on at
    Re: In PA editable grid control, index.ts init method, trying to get primaryImageAttribute from context.utils.getEntityMetadata(entityName), which returns primaryImageAttribute as a promise

    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.

  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: In PA editable grid control, index.ts init method, trying to get primaryImageAttribute from context.utils.getEntityMetadata(entityName), which returns primaryImageAttribute as a promise

    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/

     

     

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 87 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 65 Super User 2025 Season 1

Overall leaderboard