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 / Fetching column metada...
Power Apps
Answered

Fetching column metadata not working as expected

(0) ShareShare
ReportReport
Posted on by 11

I am fetching related records from different tables in my PCF to populate fields in a React app. A problem is that because the data is read in as strings, it needs to be converted to match types of the interface members used in the React app. 

 

I found this method online: `getEntityMetadata(entityName: string, attributes: string[])` which can be used from the PCF context object (context.utils.getEntityMetadata). There is a similar function that is instead part of the Client API that is called from using XRM.Utiliity.getEntityMetadata 

 

I want to access the EntityMetadata object from Comonent Framework (the first link) as it supposedly contains metadata for the columns, including the column data types. But instead, both of these functions return the same value being the Client API return object (from the second link).

 

Below is an image of what is being returned by both `this.context.utils.getEntityMetadata` and `Xrm.Utility.getEntityMetaData`.

Nicefont_0-1684011478759.png

 

My control a dataset type and is being tested on a MDA. I also added the Utility feature to the ControlManifest file

Nicefont_1-1684012139675.png

 

This is bizarre as the documentation says that `context.utils.getMetadata` returns a completely different object. Can anyone see something I am missing or misunderstanding?

 

Any help is appreciated.

Categories:
  • Nicefont Profile Picture
    11 on at

    So I thought I would restate the question to try and make it more clear. 

     

    I am using the Microsoft Cloud for Financial Services data model.

     

    I am working with a dataset PCF for a contact form with the data-set being Customer Financial Holding related records, which is a joint table between Customer and Financial Holding. Financial Holding contains a lookup column called Details, which contains the data for an additional table depending on the Financial Holding Type.

     

    So my goal is to query to get the column data for the record the Details column in Financial Services is pointing to.

    Nicefont_0-1684180494790.png

     

    I want to access the table column metadata for whatever table the details column is pointing to, similar to how you can access column meta data from a data source. I found a method called getEntityMetadata that supposedly fetches an object called EntityMetadata, which contains a field for column definitions. So I used the method in the following way:

     

    const utils = {context}

    Nicefont_1-1684180494790.png

     

     

    The properties of the object, however, do not match the EntityMetadata as described in the link, and it does not contain any column definition meta data. 

     

    I found there is another function sharing the same name that is part of the Client API, and I the data being returned matches this one. In fact, I tried calling both of them, and the data being returned is the exact same

     

    Nicefont_2-1684180494791.png

    Nicefont_5-1684182165372.png

    Nicefont_3-1684180494792.png

    Why is my PCF context using the Client API function call instead of the Component Framework one when the documentation says it should be using the Component Framework version?

  • Verified answer
    Nicefont Profile Picture
    11 on at

    I found my answer. Instead of using getEntityMetadata, I used an OData query to query EntityDefinitions. https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/reference/attributemetadata?view=dataverse-latest 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard