1

I am trying to load all the available entities in the CRM, using web api and I am able to fetch all the required information.

URL/api/data/v8.0/EntityDefinitions?$select=SchemaName,LogicalName,IsValidForAdvancedFind&$filter=IsValidForAdvancedFind eq true

But, not able to populate the dropdown, on the page load (It is a HTML Page). Please help me how can I achieve that?

var select = document.getElementById("selectEntity"); 
for (var i = 0; i < results.value.length; i++)
{
  var opt = results.value[i];
  var el = document.createElement("option");
  el.textContent = opt["SchemaName"];
  el.value = opt["LogicalName"];
  select.appendChild(el);
}
msanford
  • 11,125
  • 10
  • 64
  • 87
SaiKrishnaG
  • 187
  • 1
  • 12
  • 1
    Possible duplicate of [how to dynamically add options to an existing select in vanilla javascript](https://stackoverflow.com/questions/17730621/how-to-dynamically-add-options-to-an-existing-select-in-vanilla-javascript) – Arun Vinoth - MVP Jul 07 '17 at 19:06
  • May be change textContent into text, it should work.. – Arun Vinoth - MVP Jul 10 '17 at 00:48

1 Answers1

0

You have to change the syntax for dropdown text assignment.

el.text = opt["SchemaName"];
Arun Vinoth - MVP
  • 21,521
  • 14
  • 57
  • 157