Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Get record in HTML Webpage

Posted on by 12,070 Super User 2024 Season 1

Hi all

I want to get records in my configuration page which is my .HTML page. What is the best way to do this in crm 2016.

Thank You

*This post is locked for comments

  • Verified answer
    jlattimer Profile Picture
    jlattimer 24,558 on at
    RE: Get record in HTML Webpage

    I've built a tool which you can install into your organization to help build Odata queries such as this and will figure out the proper casing for elements in the request: https://github.com/jlattimer/CRMRESTBuilder/releases

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Get record in HTML Webpage

    Hi Charmis Varghese

    Where did you this "information If the case is not correct, you get HTTP 500 error."? Your answer works for me.

    Thank You

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Get record in HTML Webpage

    Hi Abdul,

    Can you try "WebResourceSet" instead of "webresourceset"?

    If the case is not correct, you get HTTP 500 error.

    Regards,

    Charmis

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Get record in HTML Webpage

    Hi all

    I am using this code and at contactRequest.status. it is giving me 500. I do not Where am I wrong.? Please help me to solve the issue.

    function ShowConfiguration() {

               debugger;

    var serverUrl = window.parent.Xrm.Page.context.getClientUrl();

    var oDataEndpointUrl = serverUrl + "/XRMServices/2011/OrganizationData.svc/";

    //var query = "axp_mc_templateSet?$top=1";

    var query = "webresourceset?$select=name&$filter=name eq 'apikey'";

    oDataEndpointUrl += query;

    var contactRequest = new XMLHttpRequest();

    //contactRequest.open("GET", ODataPath + "/ContactSet(guid'" + contactId + "')", false);

    contactRequest.open("GET", oDataEndpointUrl, false);

    contactRequest.setRequestHeader("Accept", "application/json");

    contactRequest.setRequestHeader("Content-Type", "application/json; charset=utf-8");

    contactRequest.send();

    if(contactRequest.status == 200)

    {

    var retrievedTemplate = JSON.parse(contactRequest.responseText).d;

    var retrievedTemplateRecord = retrievedTemplate.results[0];

    }

    else

    {

    //console.log('request failed.');

    //Xrm.Page.getAttribute('cobalt_contactsemail').setValue("---No Contact Found---");

    }

           }

    Thank You

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans