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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to populate data from CRM to HTML page

(0) ShareShare
ReportReport
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
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You should use WebApi to query the data - docs.microsoft.com/.../query-data-web-api

    In order to build queries in an easier way, you can use DataVerse RestBuilder - github.com/.../DRB

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi sillydeveloper,

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

    HTML

    <br><br>
    <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="">
    </div>

    JS

    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

    HTML:

    <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>
    </div>

    JS

    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>",
    "</fetch>"
    ].join("");
    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);
    }
    }

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 125

#2
11manish Profile Picture

11manish 89 Super User 2026 Season 2

#3
ParthPatel249 Profile Picture

ParthPatel249 87

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans