web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get record in HTML Webpage

(0) ShareShare
ReportReport
Posted on by 12,119 Moderator

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

I have the same question (0)
  • Abdul Wahab Profile Picture
    12,119 Moderator on at

    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

  • Verified answer
    Community Member Profile Picture
    on at

    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
    12,119 Moderator on at

    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
    jlattimer Profile Picture
    24,562 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans