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

  • Question

  • 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';

    Please suggest a workaround.  Thanks.

    Monday, February 2, 2015 10:24 PM

All replies

  • Hi,
    all your lines are not correct, that ='x' is not necessary.
    the syntax to change the label is

    Xrm.Page.getControl(fieldname).setLabel('new label');

    so for address1_postalcode field will be:

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

    and the field must be inside the form

    My blog: www.crmanswers.net - Rockstar 365 Profile

    Monday, February 2, 2015 11:11 PM
  • You're right about that and I wrote this thread in haste.

    It still wasn't working without the = 'x' i'll check if they are on the form.

    Tuesday, February 3, 2015 1:20 AM