locked
How to get Name/FullName/Title field attribute dynamically -CRM 2011 RRS feed

  • Question

  • Hi,

    I want to get the name attribute value For all entities in CRM. So I am creating a dynamics fetch expression query to retrieve the entity-related records. But In CRM 2011 this attribute name is not common.

    For example

    1. Account has 'Name'

    2. Contact has 'fullname'

    3 incident has 'title' etc.

     string fetch1 = @"
                            <fetch mapping='logical'>
                            <entity name='account'>
                            <attribute name='name'/>
                            <filter type='and'>
                            <condition attribute='accountid' operator='eq' value='[GUID]' />
                            </filter>

                            </entity>
                            </fetch> ";

                fetch1 = fetch1.Replace("[GUID]", ContactId); fetch1 = fetch1.Replace("account", entityname);

    Can you please help me to make appropriate attribute name based on the entity.

    Thanks in advance.

    -Prem

    Wednesday, January 2, 2013 10:11 AM

Answers

All replies