SetPanelVisibility Dependency action prevents users editing field when creating new record

I've created a dependency definition to hide panels as per: https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.2/Architecture/Sugar_Logic/Dependency_Actions/SetPanelVisibility/

When this is deployed the trigger field is not editable when creating a new record. Does anyone know what the problem is here? Here's my code:

<?php

$dependencies['Accounts']['acc_type_sl'] = array(
'hooks' => array("edit","view"),
'trigger' => 'equal($cn_accounttype_c,"Default")',
'triggerFields' => array('cn_accounttype_c'),
'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' => 'true',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL3',
'value' => 'true',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL4',
'value' => 'true',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL9',
'value' => 'true',
),
),
),
'notActions' => array(
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL1',
'value' => 'false',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL2',
'value' => 'false',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL3',
'value' => 'false',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL4',
'value' => 'false',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL9',
'value' => 'false',
),
),
),
);

$dependencies['Accounts']['acc_type_sco'] = array(
'hooks' => array("edit","view"),
'trigger' => 'equal($cn_accounttype_c,"Subsidiary Organisation")',
'triggerFields' => array('cn_accounttype_c'),
'onload' => true,
'actions' => array(
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL7',
'value' => 'true',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL8',
'value' => 'true',
),
),
),
'notActions' => array(
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL7',
'value' => 'false',
),
),
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL8',
'value' => 'false',
),
),
),
);

$dependencies['Accounts']['acc_type_os'] = array(
'hooks' => array("edit","view"),
'trigger' => 'equal($cn_accounttype_c,"Other")',
'triggerFields' => array('cn_accounttype_c'),
'onload' => true,
'actions' => array(
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL10',
'value' => 'true',
),
),
),
'notActions' => array(
array(
'name' => 'SetPanelVisibility',
'params' => array(
'target' => 'LBL_RECORDVIEW_PANEL10',
'value' => 'false',
),
),
),
);

Parents
  • Dependency SetPanelVisibility doesn't not make trigger readonly at all. Probably some other dependency is in charge. Just to confirm, disable such dependency and you will see trigger field still readonly.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Thanks for this I've rolled back my customisations and confirmed you are right. I can't see any field setting that might have caused this. Any idea what else I could check?

  • Hi Levi Reeves,

    Could you please check if the field is set as read only in studio or can you please check the below files whether the field has made read only in any one of the file.

    custom/modules/<moduleName>/clients/base/views/record/record.php

    custom/Extension/modules/<moduleName>/Ext/Vardefs/sugarfield_<field_name>.php

    custom/Extension/modules/<moduleName>/Ext/Dependencies/custom_name_read_only.php

    If you did not find this field as read only in any of the files, Please check if it has been customised at JS Level.

    custom/modules/<moduleName>/clients/base/views/create/create.js

    Hope this Information helps. Thank you :)

  • Hi Poojitha,

    Thanks for this I've reviewed the files as you asked. I don't think I've found the cause. Could you take a look at the snippets below and let me know if I've missed anything?

    custom/modules/<moduleName>/clients/base/views/record/record.php

    This is the only reference to the field:

              array (
                'newTab' => false,
                'panelDefault' => 'expanded',
                'name' => 'LBL_RECORDVIEW_PANEL6',
                'label' => 'LBL_RECORDVIEW_PANEL6',
                'columns' => 2,
                'placeholders' => 1,
                'fields' => 
                array (
                  0 => 
                  array (
                    'name' => 'cn_accounttype_c',
                    'label' => 'LBL_CN_ACCOUNTTYPE',
                    'span' => 12,
                  ),

    custom/Extension/modules/<moduleName>/Ext/Vardefs/sugarfield_<field_name>.php

    This is the only reference to the field:

    // created: 2020-10-16 19:44:23
    $dictionary['Account']['fields']['cn_accounttype_c']['labelValue']='Account Type';
    $dictionary['Account']['fields']['cn_accounttype_c']['dependency']='';
    $dictionary['Account']['fields']['cn_accounttype_c']['visibility_grid']='';
    

    custom/Extension/modules/<moduleName>/Ext/Dependencies/custom_name_read_only.php - file doesn't exist

    custom/modules/<moduleName>/clients/base/views/create/create.js - folder doesn't exist

     

Reply
  • Hi Poojitha,

    Thanks for this I've reviewed the files as you asked. I don't think I've found the cause. Could you take a look at the snippets below and let me know if I've missed anything?

    custom/modules/<moduleName>/clients/base/views/record/record.php

    This is the only reference to the field:

              array (
                'newTab' => false,
                'panelDefault' => 'expanded',
                'name' => 'LBL_RECORDVIEW_PANEL6',
                'label' => 'LBL_RECORDVIEW_PANEL6',
                'columns' => 2,
                'placeholders' => 1,
                'fields' => 
                array (
                  0 => 
                  array (
                    'name' => 'cn_accounttype_c',
                    'label' => 'LBL_CN_ACCOUNTTYPE',
                    'span' => 12,
                  ),

    custom/Extension/modules/<moduleName>/Ext/Vardefs/sugarfield_<field_name>.php

    This is the only reference to the field:

    // created: 2020-10-16 19:44:23
    $dictionary['Account']['fields']['cn_accounttype_c']['labelValue']='Account Type';
    $dictionary['Account']['fields']['cn_accounttype_c']['dependency']='';
    $dictionary['Account']['fields']['cn_accounttype_c']['visibility_grid']='';
    

    custom/Extension/modules/<moduleName>/Ext/Dependencies/custom_name_read_only.php - file doesn't exist

    custom/modules/<moduleName>/clients/base/views/create/create.js - folder doesn't exist

     

Children