Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Dynamically Update of Field's display name in Dynamics CRM

(0) ShareShare
ReportReport
Posted on by 80

Hi All,

Is there way to update field' s display dynamically every year.

E.g., Lets say, I have four fields as below:

Predicted Revenue 2023
Predicted Revenue 2024
Predicted Revenue 2025
Predicted Revenue 2026

on first or January 2024, the display name of Predicted Revenue field for 2023 is updated as Predicted Revenue 2024.So, we would have:

Predicted Revenue 2024
Predicted Revenue 2025
Predicted Revenue 2026
Predicted Revenue 2027

All Solutions are welcome!

Regards,

JK

  • Suggested answer
    Naveen Ganeshe Profile Picture
    Naveen Ganeshe 3,393 User Group Leader on at
    RE: Dynamically Update of Field's display name in Dynamics CRM

    Hi Persis,

    you can dynamically update the display name of a field by using JavaScript and the formContext object. The formContext  object allows you to interact with the forms, controls, and data in Dynamics 365 CRM.

    Here's an example of how you can use JavaScript to dynamically update the display name of a field:

    // Get the attribute
    var attr = formContext.getAttribute("fieldname");
    
    // Update the display name
    attr.setLabel("New Display Name");
    


    You can use this approach in different scenarios such as updating the field name based on the user's language preference, or depending on some other condition like user's role or organization.

    Additionally, you can use this approach to update the display name of fields that are part of a custom control, you can use the getControl method of the formContext object to access the custom control and update the label.


    var customControl = formContext.getControl("controlname");
    customControl.getLabel().setValue("New Display Name");
    


    Keep in mind that, these changes are only visual and do not affect the actual field name or internal behavior, also depending on the form's personalization or customization these changes could be override. It is important to test your changes in a test environment before applying them to a production environment.

  • Persis Profile Picture
    Persis 80 on at
    RE: Dynamically Update of Field's display name in Dynamics CRM

    Thanks for the response,

    I am planning to do through Code way, can you please provide any details on how to do steps 1& 2, any links guiding to that also will help me as I am new to CRM development.

    We will not have problems for other languages as we are keeping fields name like Predicted Revenue [CY], Predicted Revenue [CY+1] & so on.

    Regards,

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 10,203 Super User 2025 Season 1 on at
    RE: Dynamically Update of Field's display name in Dynamics CRM

    Hello,

    You can do it by changing the Display name or by changing Label of that field. 

    If you want to limit Name change on form level then only change label of that field on that specific form.

    if you want name change on system level then you will have to update display name of the field. so updated name will be visible on other component like views, forms, etc. 

    Thank you,

    Amit Katariya

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,081 Moderator on at
    RE: Dynamically Update of Field's display name in Dynamics CRM

    Hi Persis,

    Change the Display Name on the form with formContext.getControl(arg).setLabel(label);. &  new Date();. Use form onload event.

    Change the Display Name of the column by updating the metadata every year with recurrence Power Automate. It will impact views and e.t.c

  • Suggested answer
    Ray Profile Picture
    Ray 1,480 on at
    RE: Dynamically Update of Field's display name in Dynamics CRM

    Hi,

    Based on your requirement, there are two things need to do, first update the display text on Form, second update the display text on View.

    None-code way: Export the translate and change the display on form and view and then import the translate, this action needs to be done every year.

    Code way: 1. Write a schedule job to update the field metadata (DisplayName), this job runs every year. 2. Write some JS for the form OnLoad event and change the field display (Not sure if there is a code way to export translate and import translate).

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans