Change CRM Field and Section Label at Runtime

Some time we need to change CRM field label at runtime. This can be easily implemented through JS code. You can change like below

crmForm.all.FieldName_c.innerText=”New Label”;

you can include this code on any form event based on your requirement. I got one question on CRM Forum where user need to change CRM field label at runtime based on Picklist value.

For example we have a Picklist “Type” with two items “Customer” and “supplier” and we have another field named “Name” we want to change label of this field based on the value selected from picklist like

If user selects “Customer” then caption of the field should be “Customer Name” and if user selects “Supplier” then caption should be “Supplier Name”. so this can be implemented like below

if(crmForm.all.Type.SelectedText==”Customer”)

crmForm.all.name_c.innerText=”Customer Name”;

else if(crmForm.all.Type.SelectedText==”Supplier”)

crmForm.all.name_c.innerText=”Supplier Name”;

Also some time we need to change caption of the Section, as section is a Table basically so you need to get it’s GUID first then based on GUID you can change it’s innerText property like below

document.getElementById(‘{GUID of section}’).cells[0].innerText=”New Label”;

and GUID of the section can be easily get through Developers tool or through view->source

Hope it will help somebody !!!

2 thoughts on “Change CRM Field and Section Label at Runtime

Leave a Reply

Your email address will not be published. Required fields are marked *