Hide Panels in record View in 7.6 using Dependancies?

Following various posts here I am trying to conditionally Show/Hide some panels on a record view using dependencies.

I have tried the following but clearly have a problem as it is not working.

IF someone can point out the error of my ways I would really appreciate it.

The panels are in a custom module with the system name of "sior_Referrals"

Their visibility should be set by a drop down field called "ref_type" in that module with the values "In" or "Out".

If it is "In"

LBL_RECORDVIEW_PANEL1 should be Visible

LBL_RECORDVIEW_PANEL2 should be Hidden

If it is "Out"

LBL_RECORDVIEW_PANEL2 should be Visible

LBL_RECORDVIEW_PANEL1 should be Hidden

I am putting the following code in a file here:

\custom\modules\sior_Referrals\Ext\Dependencies\deps.ext.php

<?php

$dependencies['sior_Referrals']['ref_type'] = array(

  'hooks' => array("edit","view"),

  'trigger' => 'true',

  'triggerFields' => array('ref_type'), 

  'formula' => 'equal($ref_type, "In")',

  'onload' => true,

  'actions' => array(  

  array( 'name' => 'SetPanelVisibility',

            'params' => array(  'target' => 'LBL_RECORDVIEW_PANEL1',    

                                          'value' => true,   

                                          ),  

                ), 

  array( 'name' => 'SetPanelVisibility',

            'params' => array( 'target' => 'LBL_RECORDVIEW_PANEL2',    

                                          'value' => false,   

                                              ),  

            ), 

                               ),

  );

$dependencies['sior_Referrals']['ref_type'] = array(

  'hooks' => array("edit","view"),

  'trigger' => 'true',

  'triggerFields' => array('ref_type'), 

  'formula' => 'equal($ref_type, "Out")',

  'onload' => true,

  'actions' => array(  

  array( 'name' => 'SetPanelVisibility',

            'params' => array(  'target' => 'LBL_RECORDVIEW_PANEL2',    

                                          'value' => true,   

                                          ),  

                ), 

  array( 'name' => 'SetPanelVisibility',

            'params' => array( 'target' => 'LBL_RECORDVIEW_PANEL1',    

                                          'value' => false,   

                                              ),  

            ), 

                               ),

  );

Parents
  • Hi Greg,

    PanelVisibility dependency will work based on condition meets,

    When condition meets,then panel will be visible.

    When conditions are not matching panel will be hidden.

    condition can be like below,

    'value' => 'equal($sales_stage, "Prospecting")',
    
    'value' => 'not(equal($sales_stage, "Prospecting"))',
    

    So create a file below path.

    custom/Extension/modules/Opportunities/Ext/Dependencies/hidetabs.php

    and add your code like below.

    <?php
    $dependencies['Opportunities']['hide_tabs']=array(
     'hooks' => array("edit","view"),
        'trigger' => 'true',
        'triggerFields' => array('sales_stage'),  // what field should this be triggered on
        'onload' => true,
        'actions' => array(
            array(
                'name' => 'SetPanelVisibility',  // the action you want to run
                'params' => array(
                    'target' => 'LBL_RECORDVIEW_PANEL1',  // name of the panel, can be found in the vardefs.
                    'value' => 'equal($sales_stage, "Prospecting")',  // the formula to run to determine if the panel should be hidden or not.
                ),            
            ),        
        ),
        );
    ?>
    

    Here i am checking sales_stage field.When sales stage becomes to "Prospecting",then panel(LBL_RECORDVIEW_PANEL1) will be shown.Otherwise it will be hidden.

    Try the same for your case, and play around like "not(equal($sales_stage, "Prospecting"))"

    Hope this helps!.

Reply
  • Hi Greg,

    PanelVisibility dependency will work based on condition meets,

    When condition meets,then panel will be visible.

    When conditions are not matching panel will be hidden.

    condition can be like below,

    'value' => 'equal($sales_stage, "Prospecting")',
    
    'value' => 'not(equal($sales_stage, "Prospecting"))',
    

    So create a file below path.

    custom/Extension/modules/Opportunities/Ext/Dependencies/hidetabs.php

    and add your code like below.

    <?php
    $dependencies['Opportunities']['hide_tabs']=array(
     'hooks' => array("edit","view"),
        'trigger' => 'true',
        'triggerFields' => array('sales_stage'),  // what field should this be triggered on
        'onload' => true,
        'actions' => array(
            array(
                'name' => 'SetPanelVisibility',  // the action you want to run
                'params' => array(
                    'target' => 'LBL_RECORDVIEW_PANEL1',  // name of the panel, can be found in the vardefs.
                    'value' => 'equal($sales_stage, "Prospecting")',  // the formula to run to determine if the panel should be hidden or not.
                ),            
            ),        
        ),
        );
    ?>
    

    Here i am checking sales_stage field.When sales stage becomes to "Prospecting",then panel(LBL_RECORDVIEW_PANEL1) will be shown.Otherwise it will be hidden.

    Try the same for your case, and play around like "not(equal($sales_stage, "Prospecting"))"

    Hope this helps!.

Children