cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rexkenley
Level 8

retrieveMultiple not seeing getMetadata

Hi

I have this code that is supposed to get entity metadata but it returns a 404.

 

 

 

    const metas = {},
      requests = [];

    entities.forEach(e => {
      requests.push({
        EntityFilters: 2,
        LogicalName: e,
        RetrieveAsIfPublished: false,
        getMetadata() {
          return {
            boundParameter: null,
            operationType: 1,
            operationName: "RetrieveEntityRequest",
            parameterTypes: {
              EntityFilters: {
                typeName: "Microsoft.Dynamics.CRM.EntityFilters",
                structuralProperty: 0
              },
              LogicalName: {
                typeName: "Edm.String",
                structuralProperty: 1
              },
              RetrieveAsIfPublished: {
                typeName: "Edm.Boolean",
                structuralProperty: 1
              }
            }
          };
        }
      });
    });

    console.log(`Requests: ${JSON.stringify(requests)}`);

    const result = await context.webAPI.executeMultiple(requests),
      json = result && (await result.json());

    console.log(`JSON: ${JSON.stringify(json)}`);

 

 

 

Looking at the network traffic I noticed that EntityFilters is undefined and getMetadata is null. Any help is appreciated, thanks!

 

--batch_1576117091198 Content-Type: application/http Content-Transfer-Encoding: binary GET /api/data/v9.0/RetrieveEntityRequest(EntityFilters=@EntityFilters,LogicalName=@LogicalName,RetrieveAsIfPublished=@RetrieveAsIfPublished,getMetadata=@getMetadata)?@EntityFilters=undefined&@LogicalName='account'&@RetrieveAsIfPublished=false&@getMetadata=null HTTP/1.1 Accept: application/json Prefer: odata.include-annotations="*" --batch_1576117091198 Content-Type: application/http Content-Transfer-Encoding: binary GET /api/data/v9.0/RetrieveEntityRequest(EntityFilters=@EntityFilters,LogicalName=@LogicalName,RetrieveAsIfPublished=@RetrieveAsIfPublished,getMetadata=@getMetadata)?@EntityFilters=undefined&@LogicalName='contact'&@RetrieveAsIfPublished=false&@getMetadata=null HTTP/1.1 Accept: application/json Prefer: odata.include-annotations="*"

 

 

 

7 REPLIES 7
a33ik
Level 8

Re: retrieveMultiple not seeing getMetadata

Hello,

Is there any reason you can't use getEntityMetadata of utility?

https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-utili...

rexkenley
Level 8

Re: retrieveMultiple not seeing getMetadata

Thanks Andrew.

 

I tried that first. The downside is that I don't need all of the entity information that it returns and it only gives a list of all attributes name with no attribute metadata information. Another drawback is that you can only do separate calls for each entity.

 

I was hoping to get everything I need with one call in order to minimize the wait.

 

 

ScottDurow
Level 8

Re: retrieveMultiple not seeing getMetadata

I have also come up against this. The only solution I could find was doing a query call using an HTTP request rather than using Xrm.WebApi.*

rexkenley
Level 8

Re: retrieveMultiple not seeing getMetadata

@ScottDurow 

 

Is there a getClientUrl in powerapps if I am going for the solution that you suggested? Thanks!

a33ik
Level 8

Re: retrieveMultiple not seeing getMetadata

@rexkenley 

You can use following:

const baseUrl = (<any>context).page.getClientUrl();
Community Support Team
Community Support Team

Re: retrieveMultiple not seeing getMetadata

Hi @rexkenley ,

 

Have you checked on the above replies? Did you solve your issue?

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
rexkenley
Level 8

Re: retrieveMultiple not seeing getMetadata

Hi Mona

 

It didn't resolve the core issue, I am going to report this as a bug.

 

Thanks!

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Users online (9,624)