web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to retrieve list of entities attributes in CRM

(0) ShareShare
ReportReport
Posted on by 2,003

I have requirement to retrieve entity attributes through plugin. What are the ways to implement that.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Royal King Profile Picture
    27,686 on at
    RE: How to retrieve list of entities attributes in CRM

    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
    );
  • Suggested answer
    PS Profile Picture
    23,577 on at
    RE: How to retrieve list of entities attributes in CRM

    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

  • Abhishek Gupta Profile Picture
    2,003 on at
    RE: How to retrieve list of entities attributes in CRM

    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.

  • Suggested answer
    PS Profile Picture
    23,577 on at
    RE: How to retrieve list of entities attributes in CRM

    Hi Abhishek,

    I think Chitra's suggestion would work, have you tried

  • Abhishek Gupta Profile Picture
    2,003 on at
    RE: How to retrieve list of entities attributes in CRM

    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.

  • Verified answer
    Royal King Profile Picture
    27,686 on at
    RE: How to retrieve list of entities attributes in CRM

    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;

    }

  • Suggested answer
    Ganesh Chowhan Profile Picture
    160 on at
    RE: How to retrieve list of entities attributes in CRM

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans