How to change the dropdown list after add relationship from the subpanel

I have a field location_type with dropdown list known_unknown_list. After adding the relationship through the subpanel I want to change it with im_location_type_list. And after unlink, the relationship wants to change it again known_unknown_list(or location_type field is null/blank).

Location Type Field(In Parent Module) on creating or Edit

Location Fied Showing Blank because option not in the list

Here we are pulling all Inventory Management field records in the Parent Module field like Location Type, Location(Building), Location (Rooms), etc.

Want to change these options to show in the field

I tried the SugarLogic SetOptions action but not working for me.

$dependencies['II_Inventory_Item']['setoptions_location_type'] = array(
   'hooks' => array("edit"),
   'trigger' => 'true',
   'triggerFields' => array('location_type'),
   'onload' => true,
   'actions' => array(
     array(
       'name' => 'SetOptions',
       'params' => array(
         'target' => 'location_type',
         'keys' => 'getDropdownKeySet("im_location_type_list")',
         'labels' => 'getDropdownValueSet("im_location_type_list")'
       ),
     ),
   ),
);
Parents
  • Hi ,

    I don't think SetOptions can depend on a subpanel value - but you can try doing this using an additional field - say inventory_count which can be a formula field with formula = count($inventoryitems), for example.

    Then in the SetOptions, you can use that as the trigger, and define the keys and labels accordingly, based on whether the inventory count is zero or not. Here is an example:


    $dependencies['Parent_Module']['setoptions_location_type'] = array(
    'hooks' => array("edit"),
    'trigger' => 'true',
    'triggerFields' => array('inventory_count'),
    'onload' => true,
    'actions' => array(
    array(
    'name' => 'SetOptions',
    'params' => array(
    'target' => 'location_type',
    'keys' => 'ifElse(equal($inventory_count, 0), getDropdownValueSet("im_known_unknown_list"), getDropdownValueSet("im_location_type_list"))',
    'labels' => 'ifElse(equal($inventory_count, 0), getDropdownValueSet("im_known_unknown_list"), getDropdownValueSet("im_location_type_list"))',
    ),
    ),
    ),
    );
Reply Children
No Data