Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Querying metadata and data values

Posted on by 25

Hello there,

I'm starting learning CRM through an intership and currently working on an solution in which I will show some statistics in a Iframe with a webpage.

For such, i'm querying the CRM with the sdk web api (javascript - MSCRM Solution), and for this example i will use generic fields for better understanding:

WebApi.retrieveRecord(VinID, "accounts", "accountnumber,name,telephone1", null,
function (result) {
OppRecords = result;
},
function (error) {
alert("[Could not get the data] - Error Message : " + error.message);
},
false, null
);

Here are 2 examples of the json:

    • @odata.etag:"W/"1079634"",
    • accountnumber:"AF3HN2S4",
    • name:"A. Datum",
    • telephone1:"+86-23-4444-0100",
    • accountid:"475b158c-541c-e511-80d3-3863bb347ba8"
    },
  • {
    • @odata.etag:"W/"1007819"",
    • accountnumber:"ABSS4G45",
    • name:"Adventure Works",
    • telephone1:"+27-264-1234567",
    • accountid:"a8a19cdd-88df-e311-b8e5-6c3be5a8b200"

      Is there any way to query the metadata (the display name, the type of the fields) in the same query and have them in the corresponding object of the json received? If so, how will i query it?

      Or will i have to do two different queries and then try to put everything together?


      Thank you very much for your patience!

*This post is locked for comments

  • Suggested answer
    Siddique mahsud Profile Picture
    Siddique mahsud 11 on at
    RE: Querying metadata and data values

    You cannot get entity data/records and meta data in single odata call, you need a seperate odata web Api call for metadata.

    You can check below link for retrieving meta data.

    docs.microsoft.com/.../retrieve-metadata-name-metadataid

    Thanks

  • Verified answer
    jlattimer Profile Picture
    jlattimer 24,558 on at
    RE: Querying metadata and data values

    You'd need 2 separate Web API operations or combine the 2 operations in an Action/plug-in and and then have 1 Web API call.

    Metadata isn't stored like an entity so you wouldn't naively be able to do a join.

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans