Home > CRM 2011, CRM 4.0, JScript > How to change CRM form field’s label text and color using Jscript

How to change CRM form field’s label text and color using Jscript

Hi,

Below is the sample JScript to change the color and text of  CRM form field’s  label; Place the code in JScript “onload” event

// To change color

if(crmForm.all.new_fieldname != null) {

var field = crmForm.all.new_fieldname_c; //”_c” is the caption (i.e.,Label)

if (field != null)

field.style.color = ‘gray’; //Specify your desired color

}

Same script work for both CRM 4.0 & CRM 2011

// To set the label

Xrm.Page.ui.controls.get(fieldname).setLabel(‘New label’);

🙂

Advertisement
  1. Chris
    April 11, 2013 at 1:22 AM

    Works great! Thank you so much!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: