cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rexkenley Advocate IV
Advocate IV

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
MVP

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 Advocate IV
Advocate IV

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.

 

 

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 Advocate IV
Advocate IV

Re: retrieveMultiple not seeing getMetadata

@ScottDurow 

 

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

Highlighted
MVP

Re: retrieveMultiple not seeing getMetadata

@rexkenley 

You can use following:

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

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.
rexkenley Advocate IV
Advocate IV

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Users online (8,021)