Show/Hide Section based on the value of a dependent picklist

Posted by Paulh0763 on 11-May-2016 08:43

Is it possible to show and hide a section based on one value of a dependent picklist? 

I have a picklist field called "Case Category" and a dependent picklist field called "Case_Picklist". I only want the STOP PAYMENT section to show if the case category is "Payroll" and the case_picklist is "Stop Payment" anything else selected should hide the STOP PAYMENT section. I can get it to show using the following script but all the options in the dependent when selecting Payroll on the first level show the STOP PAYMENT section. I hope this makes sense?

function customizeEdit() {
var sectionID = rbf_getSectionIdByTitle("Stop Payment");
var code = rbf_getPicklistCode("case_category");
rbf_showOrHideSection(sectionID , code=="Payroll");

I even tried it this way too...

var sectionID = rbf_getSectionIdByTitle("Stop Payment");
var code = rbf_getPicklistCode("case_picklist_1");
rbf_showOrHideSection(sectionID , code=="SP");

If there is a better way to do this please share with me. I was just thinking I could use a simple script since I only want one on value type to show the section from the dependent list.

My current version is

Thanks, Paul

All Replies

Posted by Chandrasekhar Gontla on 12-May-2016 00:50

Hi Paulh,

It is not possible to show or hide section based on value of a dependent picklist field as the method rbf_getPicklistCode()  is not working on the top of depenedent picklist. It is a known issue TP #31660.

But, you could acheive the same thing using different method called rbf_getFieldValue();

Please see the below code snippet for the same


 function showOrHideBasedOnDP(){

   var sectionId = rbf_getSectionIdByTitle("Dependent Picklist");


   //var code = rbf_getPicklistCode("Dependent_Picklist");


  var dpID = rbf_getFieldValue("Dependent_Picklist");


   rbf_showOrHideSection(sectionId, dpID == 72348283);



Note: You can get the id of a dependent pikclist using template helper. See the attached screenshot for the same

> Put the function call showOrHideBasedOnDP(); in onChange event of dependent picklist. (Object Definition -> Dependent Picklist field ->Events page)

> If you don't want to show the section by default when navigated to the new/edit record page. Go to Event page of those pages add the same function call in onLoad event

Thanks and Regards,


This thread is closed