I'm using the RetrieveEntityRequest to get AttributeType information against field logical name for all fields on the requested entity.
// retrieve the metadata var req = new RetrieveEntityRequest() { EntityFilters = Microsoft.Xrm.Sdk.Metadata.EntityFilters.Attributes, LogicalName = logicalName }; var response = service.Execute( req ) as RetrieveEntityResponse; // add metadata to Cache if ( metadataCache == null ) { metadataCache = new Dictionary<string, Dictionary<string, AttributeTypeCode?>>(); } metadataCache.Add( logicalName, response.EntityMetadata.Attributes.ToDictionary( attr => attr.SchemaName.ToLower(), attr => attr.AttributeType ) ); // respond from cache return metadataCache[logicalName];
I am caching the result, but I've reset IIS and stepped through to check this isn't causing the issue, this code is called from a CustomActivity workflow so I get the service directly from the workflow context. The field is published and used on the form and even shows up in the Target entity on the context, but not in the MetaData.
The workflow is registered to be synchronous, Organisation scope and to run as the Workflow owner, though I don't think this is relevant as I've also tested as "The user who fired the workflow".
Running CRM 2013 (not SP1).