{"id":311,"date":"2010-08-19T17:32:27","date_gmt":"2010-08-19T17:32:27","guid":{"rendered":"http:\/\/mahenderpal.wordpress.com\/?p=311"},"modified":"2010-08-19T17:32:27","modified_gmt":"2010-08-19T17:32:27","slug":"change-crm-field-and-section-label-at-runtime","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=311","title":{"rendered":"Change CRM Field and Section Label at Runtime"},"content":{"rendered":"<p>Some time we need to change CRM field label at runtime. This can be easily implemented through JS code. You can change like below<\/p>\n<p>crmForm.all.FieldName_c.innerText=\u201dNew Label\u201d;<\/p>\n<p>you can include this code on any form event based on your requirement. I got one question on CRM Forum\u00a0where user need to change CRM field label at runtime based on Picklist value.<\/p>\n<p>For example we have a Picklist \u201cType\u201d with two items \u201cCustomer\u201d and \u201csupplier\u201d and we have another field named \u201cName\u201d we want to change label of this field based on the value selected from picklist like<\/p>\n<p>If user selects \u201cCustomer\u201d then caption of the field should be \u201cCustomer Name\u201d and if user selects \u201cSupplier\u201d then caption should be \u201cSupplier Name\u201d. so this can be implemented like below<\/p>\n<p>if(crmForm.all.Type.SelectedText==\u201dCustomer\u201d)<\/p>\n<p>crmForm.all.name_c.innerText=\u201dCustomer Name\u201d;<\/p>\n<p>else if(crmForm.all.Type.SelectedText==\u201dSupplier\u201d)<\/p>\n<p>crmForm.all.name_c.innerText=\u201dSupplier Name\u201d;<\/p>\n<p>Also some time we need to change caption of the Section, as section is a Table basically so you need to get it\u2019s GUID first then based on GUID you can change it\u2019s innerText property like below<\/p>\n<p>document.getElementById(\u2018{GUID of section}\u2019).cells[0].innerText=\u201dNew Label\u201d;<\/p>\n<p>and GUID of the section can be easily get through Developers tool or through view-&gt;source<\/p>\n<p>Hope it will help somebody !!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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=\u201dNew Label\u201d; you can include this code on any form event based on your requirement. I got one question on CRM Forum\u00a0where user need to change CRM field label at runtime based on Picklist value. For&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=311\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[25],"tags":[],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/311"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311"}],"version-history":[{"count":0,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/311\/revisions"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}