How to make a dependent field based on user assigned to record

Is there any way to make a field in a module dependent on whether a specific user is assigned to the record?

E.g. if 'John Smith' is assigned to the record then text field 'ABC' appears.

Parents Reply
  • You have to check your value with field "assigned_user_name" instead field "user_name" . Here is sample code for making visible field "phone_mobile" for leads module.When assigned user is "Ajay Kumar",then phone_mobile field will be visible,otherwise it will be hidden.

    $dependencies['Leads']['test_visibility_assigned_user']=array(
      'hooks'=>array("edit"),
      'trigger'=>'true',
      'triggerFields'=>array('assigned_user_name'),
      'onload'=>true,
      'actions'=>array(
      array(
      'name'=>'SetVisibility',
      'params'=>array(
      'target'=>'phone_mobile',
      'label'=>'phone_mobile_label',
        'value'=>'equal($assigned_user_name,"Ajay Kumar")',
      ),
      ),
      ),
      );
    
Children
No Data