Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to retrieve CRM Entity Metadata and Fields information in HTML Page ?

(0) ShareShare
ReportReport
Posted on by 1,442

Hi Everyone,

I have a requirement to show CRM Entity Metadata to show all Entities (Display Names) in a drop down and based on entity selection, it should show the list of fields (Display Names) in HTML form.

Example: Entities (Dropdown) - Contact

--------------------------------------------

First Name

Last Name

etc.,

--------------------------------------------

How can it be achieved ion HTML Page in CRM 2016?

Thanks in advance.

*This post is locked for comments

  • Amrutha B K Profile Picture
    Amrutha B K 225 on at
    RE: How to retrieve CRM Entity Metadata and Fields information in HTML Page ?

    i tried the above code,i am getting only the entity name in the dropdown  based on the entity name not able to filter the field name,through this code how to filter the Attribute based on the entity,please suggest me.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to retrieve CRM Entity Metadata and Fields information in HTML Page ?

    Hi Arun,

    We can retrieve attributes of an entity on a form using SystemForm metadata. SystemForm has information of all the forms present on the Entity and also formxml which can be used to parse the field names present on the form. Refer below code:

    <html><head>
    <meta charset="utf-8">
    <style type="text/css">
           body
            {
                background-color : #FFFFFF;
    			font-family:Segoe UI, Tahoma, Arial;
    			font-size:11px;
            }
    dynamicForm{
    	overflow-y:scroll;
    }
    		td{
    	color: #3b3b3b;
    	font size=11px;
    text-align: center;
    	}
    		select{
    font-family:Segoe UI, Tahoma, Arial;
    			font-size:11px;
    valign:top;
    }
    .tablabel{
    		font-size:15px;
    		font-weight:bold;
    		color:#1261e1;
    		font-family:Segoe UI, Tahoma, Arial
    	}
    	
    	.sectionlabel{
    		font-size:13px;
    		font-weight:bold;
    		color:#3b3b3b;
    		font-family:Segoe UI, Tahoma, Arial
    	}
    
    .section{
    		margin-left: 15px;
    	}
    
    .attributeTable{
    		margin-left: 30px;
    	}
    
    </style>
    
    <script language="javascript" src="new_jquery_1.7.1.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    
    function retrieveEntity() {
        var serverURL = parent.Xrm.Page.context.getClientUrl();
        var Query = "EntityDefinitions?$select=DisplayName,EntitySetName,ObjectTypeCode,LogicalName";
        var req = new XMLHttpRequest();
        req.open("GET", serverURL + "/api/data/v8.2/" + Query, true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
    	req.setRequestHeader("Prefer", "odata.include-annotations=*");
        req.onreadystatechange = function() {
            if (this.readyState == 4 /* complete */ ) {
                req.onreadystatechange = null;
                if (this.status == 200) {
                    var data = JSON.parse(this.response);
    				if(data!=null && data.value !=null){
    					var AllentityMetadataCollection = data.value; 
    					var entityMetadataCollection = [];
    						for(var i = 0; i <AllentityMetadataCollection.length; i++ ){
    							if(AllentityMetadataCollection[i].DisplayName && AllentityMetadataCollection[i].DisplayName.UserLocalizedLabel){
    									entityMetadataCollection[entityMetadataCollection.length] = AllentityMetadataCollection[i];
    							}
    						}
    						
    					entityMetadataCollection.sort(function (a, b) {
    					if (a.DisplayName.LocalizedLabels[0].Label < b.DisplayName.LocalizedLabels[0].Label)
    					{ return -1 }
    					if (a.DisplayName.LocalizedLabels[0].Label> b.DisplayName.LocalizedLabels[0].Label)
    					{ return 1 }
    					return 0;
    					});
    					
    					for (var i = 0; i < entityMetadataCollection.length; i++) {
    
    						var entity = entityMetadataCollection[i];
    						if($("#ddlallentity").length!=0){
    							if(entity.DisplayName.UserLocalizedLabel!=null){
    								$("#ddlallentity").append("<option value='"+entity.EntitySetName+"|"+entity.ObjectTypeCode+"|"+entity.MetadataId+"|"+entity.LogicalName+"'>"+entity.DisplayName.LocalizedLabels[0].Label+"</option>");
    							}
    						}	
    						else{
    							$("#ddlallentity").change(function (){							
    							var entityName = $("#ddlallentity option:selected").text();
    							var entityLogicalName = $("#ddlallentity option:selected").val();
    							parent.Xrm.Page.getAttribute("new_entityname").setValue(entityLogicalName);
    							if($("#ddlallForms").length!=0){
    								$("#ddlallForms").empty()
    							}
    							if($("#ddlattribute").length!=0){
    								$("#ddlattribute").empty()
    							}
    						
    							});		
    						}
    
    					}
    					selectValueonLoad();
    
    				}
                } else {
                    var error = JSON.parse(this.response).error;
                    alert(error.message);
                }
            }
        };
        req.send();
    }
    
    function setLogicalNameofEntity(){
    
    			var entityName = $("#ddlallentity option:selected").text();
    			var entLogicalName = $("#ddlallentity option:selected").val();
    			var entityLogicalName = $("#ddlallentity option:selected").val().split("|")[0];
    			var entityTypeCode = $("#ddlallentity option:selected").val().split("|")[1];
    			var entityMetadataId  = $("#ddlallentity option:selected").val().split("|")[2];
    			var entityLogicalName1 = $("#ddlallentity option:selected").val().split("|")[3];
    			parent.Xrm.Page.getAttribute("new_entityname").setValue(entityLogicalName);
    			parent.Xrm.Page.getAttribute("new_entitytypecode").setValue(entityTypeCode);
    			parent.Xrm.Page.getAttribute("new_entitymetadataid").setValue(entityMetadataId);
    			
    			if($("#ddlattribute > option").length!=0){
    					$("#ddlattribute").empty();
    				$("#ddlattribute").css({
    					'min-width': '100px'
    				});
    
    			}
    			if($("#ddlallForms > option").length!=0){
    					$("#ddlallForms").empty();
    				$("#ddlallForms").css({
    					'min-width': '100px'
    				});
    
    			}
    			$('#dynamicForm').empty();
    				var attributesRetrieved = false;
    				retrieveForms(entityLogicalName1,entityMetadataId);
    			// retrieveAttributes(attributesRetrieved,entityMetadataId);
    		}
    
    function setFormNameofEntity(){
    
    			var FormName = $("#ddlallForms option:selected").text();
    			var entityMetadataId = $("#ddlallForms option:selected").val().split("|")[0];
    			var formid = $("#ddlallForms option:selected").val().split("|")[1];
    			retrieveFormsXml(formid);
    			var FormXml = parent.Xrm.Page.getAttribute("new_formxml");
    
    			if($("#ddlattribute > option").length!=0){
    					$("#ddlattribute").empty();
    				$("#ddlattribute").css({
    					'min-width': '100px'
    				});
    			}
    
    			$('#dynamicForm').empty();
    				var attributesRetrieved = false;
    				retrieveAttributes(attributesRetrieved,entityMetadataId);
    		}
    
    
    function retrieveForms(ObjectTypeCode,entityMetadataId){
    var req = new XMLHttpRequest();
    req.open("GET", parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.2/systemforms()?$select=formid,name,objecttypecode,formxml,type&$filter=objecttypecode eq '"+ObjectTypeCode+"' and formactivationstate eq 1 and (type eq 2 or type eq 5 or type eq 6 or type eq 7 or type eq 11 or type eq 12)", true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
    req.onreadystatechange = function() {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 200) {
                var data = JSON.parse(this.response);
    			if(data!=null && data.value !=null){
    					var AllentityFormCollection = data.value; 
    					
    					var entityFormCollection = [];
    						for(var i = 0; i <AllentityFormCollection.length; i++ ){
    							if(AllentityFormCollection[i].name){
    									entityFormCollection[entityFormCollection.length] = AllentityFormCollection[i];
    							}
    						}
    						
    					entityFormCollection.sort(function (a, b) {
    					if (a.name < b.name)
    					{ return -1 }
    					if (a.name> b.name)
    					{ return 1 }
    					return 0;
    					});
    					
    					for (var i = 0; i < entityFormCollection.length; i++) {
    
    					var form = entityFormCollection[i];
    					
    						if($("#ddlallForms").length!=0){
    							if(form.name!=null){
    								
    								$("#ddlallForms").append("<option value='"+entityMetadataId+"|"+form.formid+"'>"+form.name+"|"+form['type@OData.Community.Display.V1.FormattedValue']+"</option>");
    							}
    						}
    					}
    					}
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send();
    }
    
    function retrieveFormsXml(formid){
    var req = new XMLHttpRequest();
    req.open("GET", parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.2/systemforms()?$select=formxml&$filter=formid eq "+formid.toUpperCase() , true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
    req.onreadystatechange = function() {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 200) {
                var data = JSON.parse(this.response);
    			if(data!=null && data.value[0] !=null){
    					var form = data.value[0]; 
    						if(form.formxml!=null){
    							parent.Xrm.Page.getAttribute("new_formxml").setValue(form.formxml);
    						}
    					}
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send();
    }
    
    function retrieveAttributes(attributesRetrieved,entityMetadataId) {
        var serverURL = parent.Xrm.Page.context.getClientUrl();
        var Query = "EntityDefinitions("+ entityMetadataId.toUpperCase() +")?$select=LogicalName&$expand=Attributes($select=LogicalName,DisplayName)";
        var req = new XMLHttpRequest();
        req.open("GET", serverURL + "/api/data/v8.2/" + Query, true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
    	req.setRequestHeader("Prefer", "odata.include-annotations=*");
        req.onreadystatechange = function() {
            if (this.readyState == 4 /* complete */ ) {
                req.onreadystatechange = null;
                if (this.status == 200) {
                    var data = JSON.parse(this.response);
    				if(data!=null && data.Attributes!=null){
    					
    					var AllAttributesCollection = data.Attributes; 
    					var attributesCollection = [];
    						for(var i = 0; i <AllAttributesCollection.length; i++ ){
    							if(AllAttributesCollection[i].DisplayName && AllAttributesCollection[i].DisplayName.UserLocalizedLabel){
    									attributesCollection[attributesCollection.length] = AllAttributesCollection[i];
    							}
    						}
    
    					attributesCollection.sort(function (a, b) {
    					if (a.DisplayName.LocalizedLabels[0].Label < b.DisplayName.LocalizedLabels[0].Label)
    					{ return -1 }
    					if (a.DisplayName.LocalizedLabels[0].Label> b.DisplayName.LocalizedLabels[0].Label)
    					{ return 1 }
    					return 0;
    					});
    					
    					var formxml = parent.Xrm.Page.getAttribute("new_formxml");
    					for (var i = 0; i < attributesCollection.length; i++) {
    						var attribute = attributesCollection[i];
    						if(formxml && formxml.getValue() != null)
    						if($("#ddlattribute").length!=0){
    						attribute.LogicalName
    							if(attribute.DisplayName.UserLocalizedLabel!=null && attribute.LogicalName!=null && formxml.getValue().search(attribute.LogicalName) !== -1){
    								$("#ddlattribute").append("<option value='"+attribute.LogicalName+"'>"+attribute.DisplayName.LocalizedLabels[0].Label+"</option>");
    							}
    						}
    						}
    					}	
                } 
    			else {
                    var error = JSON.parse(this.response).error;
                    alert(error.message);
    			}
            }
        };
        req.send();
    }
    
     window.onload = retrieveEntity;
    
    </script>
    <meta></head>
    <body style='margin: 0px;'>
    <table height='1%' class='ms-crm-FormSection' id='{91951bf5-186c-4bb4-8d0b-80c807212b46}' style='table-layout: fixed;' cellspacing='0' cellpadding='3' valign='top' isviewportsection='0' label='General' columns='2' control='[object Object]'>
    <colgroup>
    <col width='120'>
    <col>
    <col width='140' class='FormSection_WriteColumnHeaders_col'>
    <col>
    </colgroup><tbody>
    <tr valign='top'>
    <td title='Entity' class='ms-crm-FieldLabel-LeftAlign ms-crm-Field-Normal' id='ddlallentity_c' style='text-align: left; color: rgb(59, 59, 59); font-size: 11px;'><label for='ddlallentity'>Entity</label></td>
    <td width='300' id='ddlallentity_d' formxmlcolspan='1' isautoexpanding='FALSE'><select name='ddlallentity' tabindex='1790' class='ms-crm-SelectBox ' id='ddlallentity' style='float: left; -ms-ime-mode: auto; min-width: 100px;' onchange='setLogicalNameofEntity()' defaultselected='-1' req='0' attrname='ddlallentity' attrpriv='7'></select></td>
    <td title='Form Name' class='ms-crm-FieldLabel-LeftAlign ms-crm-Field-Normal' id='ddlallForms_c' style='text-align: left; color: rgb(59, 59, 59); font-size: 11px;'><label for='ddlallForms'>Form Name</label></td>
    <td width='300' id='ddlallForms_d' formxmlcolspan='1' isautoexpanding='FALSE'><select name='ddlallForms' tabindex='1790' class='ms-crm-SelectBox ' id='ddlallForms' style='float: left; -ms-ime-mode: auto; min-width: 100px;' onchange='setFormNameofEntity()' defaultselected='-1' req='0' attrname='ddlallForms' attrpriv='7'></select></td>
    <td title='Field Name' class='ms-crm-FieldLabel-LeftAlign ms-crm-Field-Normal' id='ddlattribute_c' style='color: rgb(59, 59, 59); padding-left: 20px; font-size: 11px;'><label for='ddlattribute'>Field Name</label></td>
    <td id='ddlattribute_d' formxmlcolspan='1' isautoexpanding='FALSE'><select name='ddlattribute' tabindex='1880' class='ms-crm-SelectBox ' id='ddlattribute' style='-ms-ime-mode: auto; min-width: 100px;' onchange='setIdOfAttribute()' defaultselected='-1' req='0' attrname='ddlattribute' attrpriv='7'></select></td></tr></tbody></table>
    <div id='dynamicForm' style='font-family: undefined;'></div>
    <div id='iframediv' style='font-family: undefined; display: none;'><iframe id='MyFormIframe'>
    </iframe></div></body></html>
  • Arun Potti Profile Picture
    Arun Potti 1,442 on at
    RE: How to retrieve CRM Entity Metadata and Fields information in HTML Page ?

    Hi Akhtar,

    Thank you very much for the code.

    Is there any way to get the fields information placed on the Form only with Field Type, instead of all fields?

  • Suggested answer
    Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: How to retrieve CRM Entity Metadata and Fields information in HTML Page ?

    Hi

    Please refer the below URL

    msdn.microsoft.com/.../mt607522.aspx

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to retrieve CRM Entity Metadata and Fields information in HTML Page ?

    Use Below Code:

    <html><head>
    <meta charset="utf-8">
    <style type="text/css">
           body
            {
                background-color : #FFFFFF;
    			font-family:Segoe UI, Tahoma, Arial;
    			font-size:11px;
            }
    dynamicForm{
    	overflow-y:scroll;
    }
    		td{
    	color: #3b3b3b;
    	font size=11px;
    text-align: center;
    	}
    		select{
    font-family:Segoe UI, Tahoma, Arial;
    			font-size:11px;
    valign:top;
    }
    .tablabel{
    		font-size:15px;
    		font-weight:bold;
    		color:#1261e1;
    		font-family:Segoe UI, Tahoma, Arial
    	}
    	
    	.sectionlabel{
    		font-size:13px;
    		font-weight:bold;
    		color:#3b3b3b;
    		font-family:Segoe UI, Tahoma, Arial
    	}
    
    .section{
    		margin-left: 15px;
    	}
    
    .attributeTable{
    		margin-left: 30px;
    	}
    
    </style>
    
    <script language="javascript" src="new_jquery_1.7.1.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    
    function retrieveEntity() {
    	debugger;
        var serverURL = parent.Xrm.Page.context.getClientUrl();
        var Query = "EntityDefinitions?$select=DisplayName,EntitySetName,ObjectTypeCode";
        var req = new XMLHttpRequest();
        req.open("GET", serverURL + "/api/data/v8.2/" + Query, true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
    	req.setRequestHeader("Prefer", "odata.include-annotations=*");
        req.onreadystatechange = function() {
            if (this.readyState == 4 /* complete */ ) {
                req.onreadystatechange = null;
                if (this.status == 200) {
                    var data = JSON.parse(this.response);
    				if(data!=null && data.value !=null){
    					var AllentityMetadataCollection = data.value; 
    					var entityMetadataCollection = [];
    						for(var i = 0; i <AllentityMetadataCollection.length; i++ ){
    							if(AllentityMetadataCollection[i].DisplayName && AllentityMetadataCollection[i].DisplayName.UserLocalizedLabel){
    									entityMetadataCollection[entityMetadataCollection.length] = AllentityMetadataCollection[i];
    							}
    						}
    						
    					entityMetadataCollection.sort(function (a, b) {
    					if (a.DisplayName.LocalizedLabels[0].Label < b.DisplayName.LocalizedLabels[0].Label)
    					{ return -1 }
    					if (a.DisplayName.LocalizedLabels[0].Label> b.DisplayName.LocalizedLabels[0].Label)
    					{ return 1 }
    					return 0;
    					});
    					
    					for (var i = 0; i < entityMetadataCollection.length; i++) {
    
    						var entity = entityMetadataCollection[i];
    						if($("#ddlallentity").length!=0){
    							if(entity.DisplayName.UserLocalizedLabel!=null){
    								$("#ddlallentity").append("<option value='"+entity.EntitySetName+"|"+entity.ObjectTypeCode+"|"+entity.MetadataId+"'>"+entity.DisplayName.LocalizedLabels[0].Label+"</option>");
    							}
    						}	
    						else{
    							$("#ddlallentity").change(function (){							
    							var entityName = $("#ddlallentity option:selected").text();
    							var entityLogicalName = $("#ddlallentity option:selected").val();
    							parent.Xrm.Page.getAttribute("new_entityname").setValue(entityLogicalName);
    							if($("#ddlattribute").length!=0){
    								$("#ddlattribute").empty()
    							}
    						
    							});		
    						}
    
    					}
    				}
                } else {
                    var error = JSON.parse(this.response).error;
                    alert(error.message);
                }
            }
        };
        req.send();
    }
    
    function setLogicalNameofEntity(){
    			var entityName = $("#ddlallentity option:selected").text();
    			var entLogicalName = $("#ddlallentity option:selected").val();
    			var entityLogicalName = $("#ddlallentity option:selected").val().split("|")[0];
    			var entityTypeCode = $("#ddlallentity option:selected").val().split("|")[1];
    			var entityMetadataId  = $("#ddlallentity option:selected").val().split("|")[2];
    			parent.Xrm.Page.getAttribute("new_entityname").setValue(entityLogicalName);
    			parent.Xrm.Page.getAttribute("new_entitytypecode").setValue(entityTypeCode);
    			parent.Xrm.Page.getAttribute("new_entitymetadataid").setValue(entityMetadataId);
    			
    			if($("#ddlattribute > option").length!=0){
    					$("#ddlattribute").empty();
    				$("#ddlattribute").css({
    					'min-width': '100px'
    				});
    
    			}
    			$('#dynamicForm').empty();
    
    			retrieveAttributes(attributesRetrieved,entityMetadataId);
    		}
    
    
    function retrieveAttributes(attributesRetrieved,entityMetadataId) {
        var serverURL = parent.Xrm.Page.context.getClientUrl();
        var Query = "EntityDefinitions("+ entityMetadataId.toUpperCase() +")?$select=LogicalName&$expand=Attributes($select=LogicalName,DisplayName)";
        var req = new XMLHttpRequest();
        req.open("GET", serverURL + "/api/data/v8.2/" + Query, true);
        req.setRequestHeader("Accept", "application/json");
        req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
        req.setRequestHeader("OData-MaxVersion", "4.0");
        req.setRequestHeader("OData-Version", "4.0");
    	req.setRequestHeader("Prefer", "odata.include-annotations=*");
        req.onreadystatechange = function() {
            if (this.readyState == 4 /* complete */ ) {
                req.onreadystatechange = null;
                if (this.status == 200) {
                    var data = JSON.parse(this.response);
    				if(data!=null && data.Attributes!=null){
    					
    					var AllAttributesCollection = data.Attributes; 
    					var attributesCollection = [];
    						for(var i = 0; i <AllAttributesCollection.length; i++ ){
    							if(AllAttributesCollection[i].DisplayName && AllAttributesCollection[i].DisplayName.UserLocalizedLabel){
    									attributesCollection[attributesCollection.length] = AllAttributesCollection[i];
    							}
    						}
    
    					attributesCollection.sort(function (a, b) {
    					if (a.DisplayName.LocalizedLabels[0].Label < b.DisplayName.LocalizedLabels[0].Label)
    					{ return -1 }
    					if (a.DisplayName.LocalizedLabels[0].Label> b.DisplayName.LocalizedLabels[0].Label)
    					{ return 1 }
    					return 0;
    					});
    					
    					for (var i = 0; i < attributesCollection.length; i++) {
    
    						var attribute = attributesCollection[i];
    						if($("#ddlattribute").length!=0){
    							if(attribute.DisplayName.UserLocalizedLabel!=null){
    								$("#ddlattribute").append("<option value='"+attribute.LogicalName+"'>"+attribute.DisplayName.LocalizedLabels[0].Label+"</option>");
    							}
    						}
    					}	
    				}
                } 
    			else {
                    var error = JSON.parse(this.response).error;
                    alert(error.message);
    			}
            }
        };
        req.send();
    }
    
     window.onload = retrieveEntity;
    
    </script>
    <meta></head>
    <body style="margin: 0px;">
    <table height="1%" class="ms-crm-FormSection" id="{91951bf5-186c-4bb4-8d0b-80c807212b46}" style="table-layout: fixed;" cellspacing="0" cellpadding="3" valign="top" control="[object Object]" columns="2" label="General" isviewportsection="0">
    <colgroup>
    <col width="120">
    <col>
    <col width="140" class="FormSection_WriteColumnHeaders_col">
    <col>
    </colgroup><tbody>
    <tr valign="top">
    <td title="Entity" class="ms-crm-FieldLabel-LeftAlign ms-crm-Field-Normal" id="ddlallentity_c" style="text-align: left; font-size: 11px; color: #3b3b3b;"><label for="ddlallentity">Entity</label></td>
    <td width="300" id="ddlallentity_d" isautoexpanding="FALSE" formxmlcolspan="1"><select name="ddlallentity" tabindex="1790" class="ms-crm-SelectBox " id="ddlallentity" style="float: left; -ms-ime-mode: auto; min-width: 100px;" onchange="setLogicalNameofEntity()"  attrpriv="7" attrname="ddlallentity" req="0" defaultselected="-1"></select></td>
    <td title="Field Name" class="ms-crm-FieldLabel-LeftAlign ms-crm-Field-Normal" id="ddlattribute_c" style="padding-left: 20px; font-size: 11px; color: #3b3b3b;"><label for="ddlattribute">Field Name</label></td>
    <td id="ddlattribute_d" isautoexpanding="FALSE" formxmlcolspan="1"><select name="ddlattribute" tabindex="1880" class="ms-crm-SelectBox " id="ddlattribute" style="-ms-ime-mode: auto; min-width: 100px;" attrpriv="7" attrname="ddlattribute" req="0" defaultselected="-1"></select></td></tr></tbody></table>
    <div id="dynamicForm"></div>
    <div id="iframediv" style="display: none;"><iframe id="MyFormIframe">
    </iframe></div></body></html>


  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: How to retrieve CRM Entity Metadata and Fields information in HTML Page ?

    Hi Arun Potti,

    I think you can perform this using Web API. You could write a Javascript code in the HTML web resource with WebAPI call. Please refer the link below.

    community.dynamics.com/.../597643

    Hope this gives you an idea.

  • Suggested answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: How to retrieve CRM Entity Metadata and Fields information in HTML Page ?

    Hi Arun,

    Yes you can retrieve metadata using JavaScript / C# code..

    here are some links

    C#

    msdn.microsoft.com/.../jj863599.aspx

    msdn.microsoft.com/.../microsoft.xrm.sdk.messages.retrieveentityrequest.aspx

    msdn.microsoft.com/.../jj863605.aspx

    JavaScript

    msdn.microsoft.com/.../jj919080(v=crm.6).aspx

    msdn.microsoft.com/.../gg594428(v=crm.7).aspx

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans