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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

how to get Primary field ui name?

(0) ShareShare
ReportReport
Posted on by 12,119 Moderator

Hi all,

How may I get primary field UI name in c#?

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="quote">
<attribute name="name" />
<attribute name="customerid" />
<attribute name="statecode" />
<attribute name="totalamount" />
<attribute name="quoteid" />
<attribute name="createdon" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="quoteid" operator="eq" uiname="2" uitype="quote" value="{70331B62-7FAA-E611-AC7D-005056C00008}" />
</filter>
</entity>
</fetch>

Thank You

*This post is locked for comments

I have the same question (0)
  • Verified answer
    M I Mostafa Profile Picture
    4,257 on at

    Hi Abdul Wahab,

    If you mean the "Display name" of a field. You can go to Dynamics 365 --> Settings --> customisations --> open your solution (either default or your own solution) and then you need to navigate to the entity --> fields and you can see the display name there.

    Here is a screenshot of the value you are after:

    4034.quote.png

  • Verified answer
    Gopalan Bhuvanesh Profile Picture
    11,401 on at

    If you are in the form, open the Form Editor double click the primary field and in that go to the properties of the field.

    Or go to Settings and find out the details.

    You want to retrieve the display name of the field using c#?

    You will have to query Metadata.

  • Verified answer
    ashlega Profile Picture
    34,477 on at

    Hi Abdul,

     one other thing to consider.. you don't need uiname to run fetchXml queries. You can just remove it from that xml.

     If you do need to get metadata info in the c# code (and you don't want to hardcode it), then you can use RetrieveAttributeRequest SDK "request" - that will give you RetrieveAttributeResponse, and, from there, you can go to the attribute metadata which will have a display name(which is a label, btw, so it can be language-specific):

    msdn.microsoft.com/.../microsoft.xrm.sdk.metadata.attributemetadata.displayname.aspx

  • Verified answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Abdul Wahab,

    Simply go to Settings >> Customization >> Customize The System, and select the entity. After that select entity fields then you will get a list of all the entity fields. Select the fields you require and the Schema Name of the field can be correspondingly seen in the list.

    0160.1.png

    Hope this helps.

  • Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi Nithya, Alex, Gopalan and Mohamed

    I need this "eq" uiname="2" from this "quoteid" operator="eq" uiname="2" uitype="quote" value="{70331B62-7FAA-E611-AC7D-005056C00008}"

    I used this code but don't know How to find "eq" uiname="2"  with the help of c# code. I need to filter my this fetch xml: 

    "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+
    " <entity name='quote'>"+
    " <attribute name='statecode' />"+
    " <attribute name='statuscode' />"+
    " <attribute name='quoteid' />"+
    " <order attribute='statecode' descending='false' />"+
    " <filter type='and'>"+
    " <condition attribute='quoteid' operator='eq' uiname='" + uiname + "' uitype='quote' value='" + uivalue + "' />"+
    " </filter>"+
    " </entity>"+
    "</fetch>";

    for that purpose I need these two things.

                   Guid QuoteID = new Guid("{397E3C0E-66D9-DD11-A6F4-0014223ED1B7}");

                   RetrieveRequest QuoteRequest = new RetrieveRequest();

                   QuoteRequest.ColumnSet = new ColumnSet(new string[] { "statecode", "statuscode", "quoteid",});

                   QuoteRequest.Target = new EntityReference("quote", QuoteID);

                   Entity RetrieveQuote = (Entity)((RetrieveResponse)_service.Execute(QuoteRequest)).Entity;

                   if (RetrieveQuote.Contains("quoteid") && RetrieveQuote.Contains("statecode"))

                   {

                       int StatusValueOfQuote = ((OptionSetValue)RetrieveQuote["statecode"]).Value;

                        Guid QuoteName = (GUID)RetrieveQuote["quoteid"];

    }

     

    quoteid only giving me GUID = 70331B62-7FAA-E611-AC7D-005056C00008 but not uiName. I have GUID, I need uiName.

     

    The quotenumber field gives me the uiname. Is it correct to get uiname from quotenumber field? Or is there any other way?

     

    Thank You

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at

    Hi Abdul Wahab,

    The display name of the quotenumber field is Quote ID.

    55818.1.PNG

    I guess this is the field you are looking for. 

  • Suggested answer
    ashlega Profile Picture
    34,477 on at

    Hi Abdul,

    Like I said, I think you are over complicating this. Just remove uiname=.. from your fetch - it will work.

     Remove uitype as well:) You only need condition operator, attribute, and value

  • Verified answer
    gupta.ambar2009@gmail.com Profile Picture
    797 on at

    Hello Abdul,

    To access name you just write below code

    //Create Object of Enity Reference
    EntityReference Ref = new EntityReference("quote", Guid of Quote);

    //Get name by

    Ref.Name

    / Ambar

  • Verified answer
    ganeshm Profile Picture
    on at

    hi,

    you can just add the 'name' of the quote in the columnset

    QuoteRequest.ColumnSet = new ColumnSet(new string[] { "statecode", "statuscode", "quoteid","name"});

    it gives u the name of the quote right. uiname is just the name of the record.

  • ashlega Profile Picture
    34,477 on at

    Hi Ambar,

     That's not going to work - you have to read that name from crm first.

     Abdul, if you do need the name(and you don't for that fetch), you need to add "name" attribute to the columns first, and, then, you need to read it from the retrievequote

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans