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
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);
}
}