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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to change the display name of the lookup field

(0) ShareShare
ReportReport
Posted on by

Hello,

I am new to CRM and I am looking for an help to change the display name of the lookup field in related entity. By default the lookup shows the primary column field name, but instead I wanted the lookup to show other field name within the table. I have come across the below URL, but the given code doesn't seem to work.

https://learn.microsoft.com/en-us/archive/blogs/paf/how-to-display-related-entity-field-in-a-crm-lookup-instead-of-the-primary-entity-field 

Any help or suggestion is much appreciated.

Thanks,

Gowtham

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Check this - fredrikengseth.com/.../

  • Gowtham89 Profile Picture
    on at

    Hello,

    Thank you so much for this. This scenario is similar to mine where I am trying to show Product description instead of Product ID (Unique Identifier) field. I tried using the same code but I don't see anything happening, no errors and the functionality is not working as well.

    This is my code. I have created a lookup for choosing Product within the 'Services' table. I want the Product lookup to show the display name from description field instead of product number.

    Lookup Name : m***_product

    Unique identifier of Product table - productnumber (Product table)

    the field value that needs to be shown. - description (Product table)

    var sdk = window.sdk || {};

    (function (setProductDisplayName) {

       "use strict"

       this.setProductDisplayName = async function (executionContext) {

           const formContext = executionContext.getFormContext();

           let productColumn = formContext.getAttribute("productnumber");

           let productValue = (productColumn === null) ? null : productColumn.getValue();

           if (productValue !== null) {

               let productnumber = productValue[0].id.replace(/{|}/g, "");

               await Xrm.WebApi.retrieveRecord("product", productnumber).then(

                   function success(result) {

                       if (productValue[0].name === result["name"]) {

                           productValue[0].name = `${result["description"]}`

                           productColumn.setValue(productValue);

                       }

                   },

                   function (error) {

                       console.log(error.message);

                   }

               );

           }

       }

    }).call(sdk);

  • Suggested answer
    Yoshika Suzuki Profile Picture
    Microsoft Employee on at

    As mentioned in the comments, customization is required to change the display name of the lookup field.

    The items displayed during a lookup search can also be defined in the lookup view columns.

  • Gowtham89 Profile Picture
    on at

    Thank You,

    The above code is to change the display name of the lookup field. But it doesn't do anything and it doesn't throw any error as well, which makes me believe I am going wrong somewhere. Need help to understand if I have customised the JS correctly.

    Thanks

    Gowtham

  • Gowtham89 Profile Picture
    on at

    Thank you so much, I was able to figure out the issue and the functionality is working now as suggested. Thanks again for your assistance.

    Thanks

    Gowtham

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 184 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 125

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans