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)

Javascript: Changing the labels on account form (works on account name, but not other field)

(0) ShareShare
ReportReport
Posted on by

If this works:

Xrm.Page.getControl(name').setLabel('Postal Code') = 'x';

Then why do these all fail:

Xrm.Page.getControl('address1_postalcode').setLabel('Postal Code') = 'x';
Xrm.Page.getControl('address1_stateorprovince').setLabel('Province') = 'x';
Xrm.Page.getControl('address2_postalcode').setLabel('Postal Code') = 'x';
Xrm.Page.getControl('address2_stateorprovince').setLabel('Province') = 'x';
Xrm.Page.getControl('customfield').setLabel = 'x';

('Postal Code);
Xrm.Page.getControl

Please suggest a workaround.  Thanks.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    by the way I did not mess a  ' character in production.  cannot edit post.

  • Community Member Profile Picture
    on at

    You're right about that I made this email in haste.

  • Verified answer
    PS Profile Picture
    23,577 on at

    But why do you need a Javascript to change the label on form.

    It can be done from the form itself

  • Verified answer
    Mahadeo Matre Profile Picture
    17,021 on at

    Hi,

    Instead of changing label using JavaScript.. you can change label from Form customization.. so that all places you will see same label.

    All places means, all forms, views, sub grids etc. otherwise you need to change it all the places either by using supported Javascript or unsupported JavaScript.

    even if you needed.. you need can change label like

    Xrm.Page.getControl('address1_postalcode').setLabel('Postal Code');

    Here are more details on form scripting

    msdn.microsoft.com/.../gg334266.aspx

    msdn.microsoft.com/.../jj602964.aspx

    msdn.microsoft.com/.../gg328474.aspx

    Hope this will help..

    Thanks,

  • windyMill Profile Picture
    437 on at

    Can we set html string  in the label ?

  • Shidin Haridas Profile Picture
    3,499 on at

    Wendy,

    The HTML would not render if you are using the above mentioned method of setting the label.

    One workaround would be to do a direct DOM manipulation, such as document.getElementById('yourControlName'), but that would be unsupported customization & not recommended.

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