AnsweredAssumed Answered

field dependency: hidden items display when edit view first loads

Question asked by Francesca Shiekh on Mar 7, 2014
Latest reply on Jul 24, 2015 by jihed jihed
SugarCRM 6.5.15 Pro
In the Cases module I have a dependency that displays a different 'descriptor' multi-dropdown based on the product dropdown.
The expectation is that when editing an existing record if a product is already selected only the appropriate descriptor will display when the Edit View is loaded. Instead I see ALL the descriptor drop downs regardless of product and only by changing the product dropdown do the irrelevant descriptors disappear.

In detail:

In Cases module I have multiple views.
view.edit.php sets the view depending on user department:
     // support group dependent views
      $metadataFile = 'custom/modules/' . $this->module . '/metadata/editviewdefs_CS.php';
      if ($current_user->support_group_c == 'TS'){
         $metadataFile = 'custom/modules/' . $this->module . '/metadata/editviewdefs_TS.php';
      $this->ev = new EditView();
      $this->ev->ss =&  $this->ss;
      $this->ev->setup($this->module, $this->bean, $metadataFile, get_custom_file_if_exists('include/EditView/EditView.tpl'));

in custom/Extensions/modules/Cases/Ext/Vardef/vardef.ext.php
I added dependencies to hide/show multi-dropdowns depending on the product selected (visibility grid would not work on multiple drop downs so this is a workaround):

/*dependencies on multi-select don't work in v6.5
 * we need separate hide/show fields with on-save logic. 
$dictionary['Case']['fields']['case_Mathematica_Online_descriptor_c']['dependency']='equal($case_product_c,"Mathematica Online")';
$dictionary['Case']['fields']['case_Wolfram_Finance_Platform_descriptor_c']['dependency']='equal($case_product_c,"Wolfram Finance Platform")';
$dictionary['Case']['fields']['case_Wolfram_SystemModeler_descriptor_c']['dependency']='equal($case_product_c,"Wolfram SystemModeler")';
$dictionary['Case']['fields']['case_CDF_Player_descriptor_c']['dependency']='equal($case_product_c,"CDF Player")';
$dictionary['Case']['fields']['case_Wolfram_Player_Pro_descriptor_c']['dependency']='equal($case_product_c,"Wolfram Player Pro")';
$dictionary['Case']['fields']['case_Wolfram_Workbench_descriptor_c']['dependency']='equal($case_product_c,"Wolfram Workbench")';
$dictionary['Case']['fields']['case_Mathematica_Add_On_descriptor_c']['dependency']='equal($case_product_c,"Mathematica Add-On")';
When I edit an existing record all the dependency multi-dropdowns display regardless of product. If I then change the product dropdown then the various multi-dropdowns are shown/hidden based on the code specified above.

So the dependency works but will not hide all the irrelevant fields when the record is first loaded. This is a relatively recent development, users noticed only yesterday, we have used this for over a year now and this issue was never reported before.

The only change made yesterday was adding a totally irrelevant dependency in the same Extensions file:
$dictionary['Case']['fields']['case_ba_feedback_comments_c']['dependency'] = 'equal($case_ba_feedback_c,true)';

Any thoughts on getting the dependency to load when Edit View is first entered or what I might have done to break it?


NOTE: I did repair/rebuild, also deleted custom/modules/Cases/Ext and repeated repair/rebuild. Cleared both the sugarcrm/cache folder and the browser cache to no avail. Added error reporting lines to view.edit.php - no errors reported.