The below method helps us to retrieve the FormXml of a CRM Entity
private string GetFormXml(string websiteName, string entityName, IOrganizationService service) { string formXml = ""; try { RetrieveEntityRequest mdRequest = new RetrieveEntityRequest() { EntityFilters = EntityFilters.Attributes, LogicalName = entityName, RetrieveAsIfPublished = true }; // Execute the request RetrieveEntityResponse entityResponse = (RetrieveEntityResponse)service.Execute(mdRequest); //EntityMetadata entityData = entityResponse.EntityMetadata;y var entityTypeCode = entityResponse.EntityMetadata.ObjectTypeCode.Value; QueryExpression query = new QueryExpression("systemform"); query.ColumnSet = new ColumnSet("formxml"); query.Criteria.AddCondition(new ConditionExpression("name", ConditionOperator.Equal, websiteName)); query.Criteria.AddCondition(new ConditionExpression("objecttypecode", ConditionOperator.Equal, entityTypeCode)); RetrieveMultipleRequest retrieveRequest = new RetrieveMultipleRequest(); retrieveRequest.Query = query; var results = (RetrieveMultipleResponse)service.Execute(retrieveRequest); formXml = results.EntityCollection.Entities[0].Attributes["formxml"].ToString(); return formXml; } catch (FaultException ex) { throw new FaultException("Error occured while instantiating the CRM Service " + ex.ToString()); } }