Show/Hide Section based on the value of a dependent picklist - Forum - Rollbase - Progress Community

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

 Forum

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

  • 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?

    <script>
    function customizeEdit() {
    var sectionID = rbf_getSectionIdByTitle("Stop Payment");
    var code = rbf_getPicklistCode("case_category");
    rbf_showOrHideSection(sectionID , code=="Payroll");
    }
    </script>

    I even tried it this way too...

    <script>
    var sectionID = rbf_getSectionIdByTitle("Stop Payment");
    var code = rbf_getPicklistCode("case_picklist_1");
    rbf_showOrHideSection(sectionID , code=="SP");
    }
    </script>

    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 2.2.2.0

    Thanks, Paul

  • 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

    <script>

     function showOrHideBasedOnDP(){

       var sectionId = rbf_getSectionIdByTitle("Dependent Picklist");

      console.log(sectionId);

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

       //console.log(code);

      var dpID = rbf_getFieldValue("Dependent_Picklist");

      console.log(dpID);

       rbf_showOrHideSection(sectionId, dpID == 72348283);

    }

    </script>

    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,

    Chandu.