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 Pages / Retrieve Entity Metada...
Power Pages
Unanswered

Retrieve Entity Metadata or Field Attributes in D365 Portal

(0) ShareShare
ReportReport
Posted on by 2

Hi, I am not able to find any documentation to retrieve entity metadata or entity's field attributes within the custom javascript of D365 Portal.

 

I would like to get the entity's field attribute's value (e.g. CanTriggerWorkflow: true) using web api and I tried what's in this link: https://carldesouza.com/retrieving-entity-metadata-in-dynamics-365-in-javascript/ but it doesn't give any results.

I believe it is working in CRM as <crm_url> but not in Portal as <portal_url>.

 

Appreciate your help on this.

Thank you.

Categories:
I have the same question (0)
  • Lucas001 Profile Picture
    2,541 Super User 2026 Season 1 on at

    Hi @HwUduiN,

     

    what you probably want to use is the CRUD Api for power pages.

    Have a look at that tutorial: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwibqdP148qCAxWSR_EDHf0XDwcQwqsBegQIDRAG&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5PwLZd_HE30&usg=AOvVaw2TOajephGg0CYKBTnfFGmx&opi=89978449

     

    Or MS learn at: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwibqdP148qCAxWSR_EDHf0XDwcQFnoECBUQAQ&url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fpower-pages%2Fconfigure%2Fwrite-update-delete-operations&usg=AOvVaw25se7OSXNb-JaZ-5I1MfLV&opi=89978449

     



    --------------------------------------------------------------------------------------

    Hope that helps.

    If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.

  • Fubar Profile Picture
    8,487 Super User 2026 Season 1 on at

    Also note, the Portals Web API is not 100% the same as the CRM/Dynamics 365/Dataverse API (not everything in the Dataverse API is exposed in the Web API).

  • riko4 Profile Picture
    2 on at

    Hi, I really appreciate your answers but what I want to achieve is something like this in portal custom Javascript&colon;

    // Retrieve entity metadata
     $.ajax({
     type: "GET",
     contentType: "application/json; charset=utf-8",
     datatype: "json",
     url: webApiUrl + 'EntityDefinitions(LogicalName=\'' + entityLogicalName + '\')?$select=EntityId',
     beforeSend: function (xhr) {
     xhr.setRequestHeader("OData-MaxVersion", "4.0");
     xhr.setRequestHeader("OData-Version", "4.0");
     xhr.setRequestHeader("Accept", "application/json");
     xhr.setRequestHeader("Prefer", "odata.include-annotations=*");
     },
     success: function (entityMetadata) {
     var entityId = entityMetadata.EntityId;
    
     // Retrieve attribute metadata
     $.ajax({
     type: "GET",
     contentType: "application/json; charset=utf-8",
     datatype: "json",
     url: webApiUrl + 'EntityDefinitions(' + entityId + ')?$select=LogicalName&$expand=Attributes($filter=LogicalName eq \'' + attributeLogicalName + '\')',
     beforeSend: function (xhr) {
     xhr.setRequestHeader("OData-MaxVersion", "4.0");
     xhr.setRequestHeader("OData-Version", "4.0");
     xhr.setRequestHeader("Accept", "application/json");
     xhr.setRequestHeader("Prefer", "odata.include-annotations=*");
     },
     success: function (attributeMetadata) {
     var attribute = attributeMetadata.Attributes[0];
     var maxLength = attribute.MaxLength;
    
     console.log('Max length of ' + attributeLogicalName + ' field: ' + maxLength);
     },
     error: function (error) {
     console.error('Error retrieving attribute metadata:', error.statusText);
     }
     });
     },
     error: function (error) {
     console.error('Error retrieving entity metadata:', error.statusText);
     }
     });

     

    On the other hand, as expected, below piece of code is working when it runs within CRM but it is not applicable in portal: 

    req.open("GET", globalContext.getClientUrl() + "/api/data/v9.0/EntityDefinitions(LogicalName ..etc

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 61

#2
oliver.rodrigues Profile Picture

oliver.rodrigues 40 Most Valuable Professional

#3
11manish Profile Picture

11manish 30

Last 30 days Overall leaderboard