I have requirement to retrieve entity attributes through plugin. What are the ways to implement that.
*This post is locked for comments
You can retrieve entity attributes using below method
RetrieveEntityRequest req= new RetrieveEntityRequest { EntityFilters = EntityFilters.Entity, LogicalName = "EntityLogicalName" // like "account" }; RetrieveEntityResponse res= (RetrieveEntityResponse)_serviceProxy.Execute(req
);
Hi Abhishek,
Are you asking for attribute values within an entity or just the name of attribute.
Please see if following URL helps:
stackoverflow.com/.../dynamics-crm-plugin-retrieve-related-entity-attributes-value
msdn.microsoft.com/.../gg334708.aspx
msdn.microsoft.com/.../gg309673.aspx
I would suggest you to use SOAP service, it might help
Hi, I need attributes name suppose i select account then i can have a list of attributes of it or if i select contact then i can have a list of contact attributes.
I think Chitra's suggestion would work, have you tried
Yes, but i am getting the Attribute property as null. Moreover there is a entity name Metadata.Attribute which contains the list of attributes related to the entities. So look like there must be some way to retrieve it.
Here is the complete code to get attribute names of an entity.
RetrieveEntityRequest req= new RetrieveEntityRequest
{
EntityFilters = EntityFilters.Entity,
LogicalName = "EntityLogicalName" // like "account"
};
RetrieveEntityResponse res= (RetrieveEntityResponse)_serviceProxy.Execute(req
EntityMetadata currentEntity = res.EntityMetadata;
foreach(AttributeMetadata attribute in currentEntity.Attributes)
var attributeName = attribute .LogicalName;
}
RetrieveEntityRequest req = new RetrieveEntityRequest();
req.EntityFilters = EntityFilters.Attributes;
req.LogicalName = "account";
RetrieveEntityResponse res = (RetrieveEntityResponse)_service.Execute(req);
EntityMetadata currentEntity1 = res.EntityMetadata;
foreach (AttributeMetadata attribute in currentEntity1.Attributes)
Console.WriteLine(attribute.SchemaName);
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
HR-09070029-0 2
UllrSki 2
ED-30091530-0 1