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 / webAPI returns differe...
Power Apps
Unanswered

webAPI returns different types in Power Pages vs Model driven app

(0) ShareShare
ReportReport
Posted on by 601

I am working on a custom PCF, that uses the WEBAPI to fetch other records.

It seems that the api returns different types depending whether it is run in a Model Driven app or on a Power Page, therefore I need to use Nullish coalescing to get the entity properties:

 

 this
 ._context
 .webAPI
 .retrieveRecord("account", "a78cdf88-7e04-ee11-8f6e-000d3aacaa23", "")
 .then((response) => {
 console.log("get account ok: " + (response.name ?? response.data?.name));
 }, (errorResponse) => {
 console.log("error :" + errorResponse);
 });

 

In Model Driven app it is just an entity object, but in Power Pages it is an object with a "Data" property in which the entity object lives:

Model driven:

Screenshot 2023-07-27 140535.png

Power Pages:

Screenshot 2023-07-27 140429.png

Is this the expected behaviour or am I missing something?

 

A side question, is there any way to use early binding? I have tried using dataverse-ify, but Xrm is apparently not available in Power Pages...

I have the same question (0)
  • Guido Preite Profile Picture
    1,490 Super User 2024 Season 1 on at

    I don't have a Power Pages instance to try but my best guess is that in a model-driven app it piggybacks the Xrm.WebApi namespace and inside the Power Pages it uses a standard jQuery ajax call (or equivalent).

    To confirm this theory (that doesn't solve your problem) I would test with the retrieveMultipleRecords, if you get the "entities" property inside the model-driven but not inside the Power Pages, it confirms my suspictions.

    Regarding your discrepancy, a way to make the team aware of this is to open an idea here

    https://ideas.powerpages.microsoft.com/d365community/forum/1edba0ec-30cf-ec11-a7b5-000d3a545c96

  • KoJaPD Profile Picture
    601 on at

    Hi @GuidoPreite , I have tested with retrieveMultipleRecords, and that results in the same type on both platforms, just an array of entities:

     

    KoenJanssensPD_1-1690529633665.png

     

    I have compared the network requests, and both the "retrieve" calls

     

    GET https://xxx.powerappsportals.com/_api/account(a78cdf88-7e04-ee11-8f6e-000d3aacaa23)?
    GET https://xxx.crm.dynamics.com/api/data/v9.0/accounts(a78cdf88-7e04-ee11-8f6e-000d3aacaa23)

     

    have the same response, so it is the handler that behaves differently...

    I will post something on the idea site...

     

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
11manish Profile Picture

11manish 510

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 281

Last 30 days Overall leaderboard