Skip to main content



No record found.

Microsoft Dynamics CRM forum
Suggested answer

How to populate data from CRM to HTML page

Posted on by 5

I have one entity Student with field name as Name, Age, Id etc. in CRM.

Now I have created a custom HTML page, where I have dropdown for Student name.

So please tell me how can I fetch the Student name from the CRM and show it in the dropdown.

I have went through lot of resources, but had no luck. Kindly help me in this.

You can help me with some demo codes as well, that will be really very helpful.

Thanks in advance

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,068 Super User on at
    RE: How to populate data from CRM to HTML page

    Hi sillydeveloper,

    It is better to show them as a lookup by using below similar code


    <div id="Update" style="color:brown">
    Record 1 (Update) : Source Fund : <input type="text" id="sourceFundName" readonly=""><input type="button" onclick="showFundLookupDialog()" id="btnFund" value="Select"><input type="text" id="sourceFundId" hidden="">
    <!--Source Amount (Inc GST) : <input type="text" id="sourceAmountIcludingGST" readonly=""><input type="number" id="P_SourceAmountIcludingGST" value="100" readonly="" hidden="">-->
    <label for="sourceAmountIcludingGST" id="sourceAmountIcludingGSTId">% of Source Amount (Inc GST) :</label>
    <input type="text" id="sourceAmountIcludingGST" readonly="" hidden=""><input type="number" id="P_SourceAmountIcludingGST" value="100" readonly="">


    function showFundLookupDialog() {
    try {
    var lookupParameters = {};
    lookupParameters.entityTypes = ["ecs_fund"];
    lookupParameters.defaultEntityType = "ecs_fund";
    lookupParameters.defaultViewId = "{F0B85996-2784-4511-BFE2-3BBE840F609E}";
    lookupParameters.allowMultiSelect = false;
    lookupParameters.disableMru = true;
    parent.Xrm.Utility.lookupObjects(lookupParameters).then(DisplaySelectedFund, null);
    } catch (e) {
    alert("Error in showFundLookupDialog1: " + e.messagee);

    You can still use dropdown by following the below similar code


    <div class='col'>
    <label class="lbl">Campaign</label>
    <select style="font-weight:500; background-color: antiquewhite;" class='form-select' id='originalCampaign' onchange="OnchangeCampaign('originalCampaign')"></select>


    function RetrieveDropdowns() {
    try {

    //Retrieve Active Campaigns
    var fetchXmlCampaign = [
    "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>",
    " <entity name='campaign'>",
    " <attribute name='campaignid'/>",
    " <attribute name='name'/>",
    " <order attribute='name' descending='false'/>",
    " <filter type='and'>",
    " <condition attribute='statecode' operator = 'eq' value = '0' />",
    " </filter>",
    " </entity>",
    RetrievewithResults("campaigns", fetchXmlCampaign, "Results1");
    } catch (e) {
    alert("Error in retrieveDonationDetail: " + e.messagee);
    return true;

    function Dropdowns() {
    try {

    document.getElementById("originalCampaign").innerHTML = "";
    campaign: globalVariables.Results[0]["_maa_campaign_value"],

    optionsetValues.campaignId = globalVariables.Results1[k]["campaignid"];
    optionsetValues.campaignName = globalVariables.Results1[k]["name"];
    document.getElementById("originalCampaign").innerHTML += "<option value='" + optionsetValues.campaignId + "'> " + optionsetValues.campaignName + "</option></select>";

    document.getElementById("originalCampaign").value = orgvalues.campaign;

    document.getElementById("OptionsetCampaign" + a).value = orgvalues.campaign;

    } catch (e) {
    alert("Error in Dropdown: " + e.messagee);

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,313 Super User on at
    RE: How to populate data from CRM to HTML page


    You should use WebApi to query the data -

    In order to build queries in an easier way, you can use DataVerse RestBuilder -

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans