RE: Get display names of attributes from a record
Hi,
Refer this blog-
dynamics365blocks.wordpress.com/.../how-to-retrieve-display-name-of-an-attribute-in-dynamics-crm-using-c
Code snippet from the blog-
====================
public static string RetrieveAttributeDisplayName( string EntitySchemaName, string AttributeSchemaName, IOrganizationService service)
{
RetrieveAttributeRequest retrieveAttributeRequest = new RetrieveAttributeRequest
{
EntityLogicalName = EntitySchemaName,
LogicalName = AttributeSchemaName,
RetrieveAsIfPublished = true
};
RetrieveAttributeResponse retrieveAttributeResponse = (RetrieveAttributeResponse)service.Execute(retrieveAttributeRequest);
AttributeMetadata retrievedAttributeMetadata = (AttributeMetadata)retrieveAttributeResponse.AttributeMetadata;
//Get Length
// Int32 length = (Int32)((Microsoft.Xrm.Sdk.Metadata.StringAttributeMetadata)retrievedAttributeMetadata).MaxLength;
return retrievedAttributeMetadata.DisplayName.UserLocalizedLabel.Label;
}
====================
Hope this helps.