Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

WebAPI retrive data from an userquery on custom entity

Posted on by 5

Hello, 

I'm completely new to Dynamics and Web API.

We have several custom entities. I can for example check company_contract : 

GET [Organization URI]/api/data/v9.0/EntityDefinitions(LogicalName='company_contract')?

I created a userquery via advanced view on that entity.

I found this documentation how to call userqueries: 
https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/webapi/retrieve-and-execute-predefined-queries

But It seems like it is only working with predefined entities. 

Is there a possibility to call a userquery that is based on an custom entity? 

Thanks for your help in advance

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: WebAPI retrive data from an userquery on custom entity

    What you see is Id of your record. Label should be there as well and placed under the field with name

    _bwi_steuerungdurch_a_value@OData.Community.Display.V1.FormattedValue so something like following:

    "_bwi_steuerungdurch_a_value@OData.Community.Display.V1.FormattedValue": "Engagement Mgr."

  • jowabwi Profile Picture
    jowabwi 5 on at
    RE: WebAPI retrive data from an userquery on custom entity

    Now I have another issue.....

    In the reply there are not the actual values that I can see in the userquery in the portal.

    There are some kind of ID or Hash value instead.

    Is there a possibility to lookup the correct values?

    e.g.

    [...]

    "_bwi_steuerungdurch_a_value":"adca4f46-2ddc-e811-8428-00505681ec7a",[....]

    In the userquery in Dynamics there is a link with the name  "Engagement Mgr."

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: WebAPI retrive data from an userquery on custom entity

    If my reply helped you take a minute and click "Yes" near "Did this answer your question" message.

  • jowabwi Profile Picture
    jowabwi 5 on at
    RE: WebAPI retrive data from an userquery on custom entity

    Yes your are right, now it worked.

    The error was I used company_contract in the URL but it should be company_contracts.

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: WebAPI retrive data from an userquery on custom entity

    Hello,

    That should work fine for all entities. Can you may be share the code that you use that is non-worky?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans