Access fields in Header and Footer using JavaScript

Hi,

Most of times we get a requirement to access fields on Header and Footer using JavaScript.
There is a little difference in the schema to access them. That is we just need header/footer as a prefix to the field name. Below are the some of the examples.

Accessing Header Fields

//Set Enabled to True:
Xrm.Page.getControl(“header_fieldname”).setDisabled(false);
//Set Enabled to False:
Xrm.Page.getControl(“header_fieldname”).setDisabled(true);
//Set Visibility to False:
Xrm.Page.getControl(“header_fieldname”).setVisible(false);
//Set Visibility to True:
Xrm.Page.getControl(“header_fieldname”).setVisible(true);
//Get Attribute Value in Footer:
Xrm.Page.getControl(“header_fieldname”).getAttribute().getValue();
//Set Attribute Value in Footer:
Xrm.Page.getControl(“header_fieldname”).getAttribute().setValue(“anything”);

Accessing Footer Fields

//Set Visibility to False:
Xrm.Page.getControl(“footer_fieldname”).setVisible(false);
//Set Visibility to True:
Xrm.Page.getControl(“footer_fieldname”).setVisible(true);
//Get Attribute Value in Footer:
Xrm.Page.getControl(“footer_fieldname”).getAttribute().getValue();
//Set Attribute Value in Footer:
Xrm.Page.getControl(“footer_fieldname”).getAttribute().setValue(“anything”);

Hope this helps.


Happy CRM’ing

Gopinath

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 )

Google photo

You are commenting using your Google 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