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 / Retrieve Dynamic 365 E...
Power Apps
Answered

Retrieve Dynamic 365 Entities and show in a dropdown

(0) ShareShare
ReportReport
Posted on by 51

Hi, I need help, 

Is there any method to develop a code component to be used in model driven apps that will collect all D365 entities and show in dropdown. 

 

Recently I have completed a code component that show current entity fields in dropdown. 

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

    Hi @IrfanMukhtiar , 

     

    You can use the same way you've used for the fields. The only difference is how you retrieve the metadata for all entity names.

    You could use the webAPI "EntityDefinitions" function.

    export class RetrieveEntitiesRequest {
     getMetadata() {
     return {
     boundParameter: null,
     parameterTypes: {},
     operationType: 1, // This is a function. Use '0' for actions and '2' for CRUD
     operationName: "EntityDefinitions",
     };
     }
    }

     and use it similar to this

    const retrieveRequest = new RetrieveEntitiesRequest(); 
    webApi.execute(retrieveRequest).then(entityResponseParser)
    

     

    Hope this helps!

  • IrfanMukhtiar Profile Picture
    51 on at

    Hi @DianaBirkelbach 

    Thanks for responding, It helps me a lot to understand how to proceed further, but I have a query and would like to ask from you. 

     

    I have followed PCF code component documentation and as per it we can use only 5 methods by using "webAPI", along with context but execute is not part of that mentioned methods. Snip is attached

     

    Are you suggesting me to use XRM over context? 

    I am looking forward for your kind reply. 

     

    Thanks

    Irfan Mukhtiar

    Webapi Methods.PNG
  • Verified answer
    cchannon Profile Picture
    4,702 Moderator on at

    the execute() function is there in PCF context. It isn't documented yet (so technically not supported) but is already pretty widely in use. So, to an extent it is "use at your own risk" but I have to believe that MSFT will inevitably make it a formal, documented part of the webapi object.

     

    You just need to cast as any so you can use it in typescript, so something like this: 

    (context.webAPI as any).execute(myRequest);
  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @IrfanMukhtiar , 

     

    I totally agree with @cchannon .

    I would add, that the "Xrm" object is not supported inside a PCF; this is specified in the docs: Power Apps component framework API reference - Power Apps | Microsoft Docs.

    So "execute" seems the a safer way, even if not supported for now.

    Hope this helps!

     

     

     

  • Verified answer
    skoofy5 Profile Picture
    482 on at

    If I'm understanding you correctly then it's also a pretty straightforward xhr which I believe is supported.

     const queryUrl = "/api/data/v9.2/EntityDefinitions/?$select=LogicalName,DisplayCollectionName"
    
     let req = new XMLHttpRequest();
     req.open("GET", queryUrl, true);
     req.setRequestHeader("OData-MaxVersion", "4.0");
     req.setRequestHeader("OData-Version", "4.0");
     req.setRequestHeader("Accept", "application/json");
     req.onreadystatechange = function () {
     if (this.readyState === 4) {
     req.onreadystatechange = null;
     if (this.status === 200 || this.status >= 200 && this.status <= 206) {
     const results = JSON.parse(this.response);
    
     }
     }
     };
     req.send();

     

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 Apps

#1
Vish WR Profile Picture

Vish WR 762

#2
11manish Profile Picture

11manish 640

#3
Valantis Profile Picture

Valantis 548

Last 30 days Overall leaderboard