Quantcast
Channel: Microsoft Dynamics CRM
Viewing all articles
Browse latest Browse all 154803

Forum Post: RE: Metadata call in D365 using WebAPI in JavaScript

$
0
0
It will help you to get all entity and it attributes. function startSample() { //alert("Keyur"); /// /// Initializes the sample when the document is ready /// //Assign the global variables results = document.getElementById("results"); message = document.getElementById("message"); //document.getElementById("btnstartSample").setAttribute("disabled", "disabled"); //Retrieve entities SDK.Metadata.RetrieveAllEntities(SDK.Metadata.EntityFilters.Entity, false, successRetrieveAllEntities, errorRetrieveAllEntities); //setText(message, "Loading..."); } function successRetrieveAllEntities(entityMetadataCollection) { /// /// Receives the data from SDK.Metadata.RetrieveAllEntities and /// appends a list item to results for each one. /// entityMetadataCollection.sort(function(a, b) { if (a.LogicalName b.LogicalName) { return 1 } return 0; }); for (var i = 0; i < entityMetadataCollection.length; i++) { var entity = entityMetadataCollection[i]; var entityNode = document.createElement("li"); var entitySpan = document.createElement("span"); //debugger; if (entity.DisplayName != null && entity.DisplayName.UserLocalizedLabel != null) { setText(entitySpan, entity.DisplayName.UserLocalizedLabel.Label); entitySpan.title = entity.DisplayName.UserLocalizedLabel.Label; } //setText(entitySpan, entity.SchemaName); entitySpan.id = entity.LogicalName; entitySpan.attributesRetrieved = false; // Add the event handler to retrieve attributes entitySpan.onclick = retrieveAttributes; //entitySpan.style.cursor = "pointer"; entitySpan.style="font-size:12.5px; font-family:Segoe UI, Tahoma, sans-serif; font-style:normal; color:dimgray; cursor:pointer;"; entityNode.appendChild(entitySpan); results.appendChild(entityNode); } //setText(message, entityMetadataCollection.length + //" entities retrieved. Click each entity to retrieve the entity attributes."); if (alertFlag.checked == true) alert("Entity List Retrieved."); }

Viewing all articles
Browse latest Browse all 154803

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>