Dependency not working in record view

We implimented Dependency for field Visibility, At record creation Visibility formula working fine but when we view the record these field are visible in record view.

We use this formula for all fileds in Department info and time info tab .

Formula we are using:

In create view fields are hidden that's working according our requirements:

Record view:

Please provide any solution for this.

Parents
  • Hi Sandeep,

    According to your formula in the logic, the fields will be visible only when two conditions are met.

    1. When $select_template_c field is empty and $relative_template_c is "No".

    But as mentioned in the above screenshot, $select_template is not empty and it is having some value in it.

    Can you please check the below things to debug this issue a little more and fix it.

    1. Can you please paste the entire code you have used in the dependency file and paste it, so we can check in a detailed way.

    2. Which version and edition of Sugar you are using? If you are using the latest versions, you can hide and show the fields conditionally through Studio itself. Do you even no need of writing the code in Dependencies also?

    3. Are you sure you are referring to the same fields you have used in the Sugar logic in the Sugar UI also? 

    4. When you are talking about record view, it applies to the existing records. Are you sure for all the existing records even though the condition is satisfied the fields are visible? One more thing to check here, After implementing this logic have you recalculated the records? If not you have to do this because for the existing records you have to edit and save (or you can do recalculate through the list view actions menu) the record to trigger this logic and to make it work.

    Hope this information helps to debug the issue.

    Thanks and Best Regards,

    PK

    www.bhea.com

  • $dependencies['M03_Work_Product_Deliverable']['visibility_work_product_deliverable_fields_department'] = array(
        'hooks'         => array("edit", "view", "save", "all"),
        'trigger'       => 'true',
        'triggerFields' => array('id','name','relative_template_c','select_template_c','author_c','pathologist_workload_c','department_manager_approval_c','integer_estimated_owner_c','estimated_report_hours_c','integer_actual_owner_c','actual_hours_owner_c','date_qa_received_c','date_qa_edits_received_c','deliverable_lead_time_c','report_writing_days_c'),
        'onload'        => true,
        'actions' => array(
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'author_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'pathologist_workload_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'department_manager_approval_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'integer_estimated_owner_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'estimated_report_hours_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'integer_actual_owner_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'actual_hours_owner_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'date_qa_received_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'date_qa_edits_received_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'deliverable_lead_time_c',                
                    'value'  => 'and(equal($select_template_c,""),equal($relative_template_c,"No"))',
                ),
            ),
            array(
                'name'   => 'SetVisibility',
                'params' => array(
                    'target' => 'report_writing_days_c',                
                    'value'  => 'and(equal($select_template_c,""),isInList($deliverable_c,createList("Histopathology Report2","Histopathology Report","Interim Gross Pathology Report","Interim Histopathology Report2","Interim Histopathology Report","Histopathology Notes")))',
                ),
            ),
        ),
    );
     
    above screenshot our  $select_template_c field is not empty and $relative_template_c is "No". that's not meet our criteria so fields are not visible but fields are visible see below screenashot.
  • Hi Sandeep,

    In your first question, you have mentioned it is working in create view but not for record view. But the screenshots you have provided are for creat view. dependency code looks fine, the other logic used in this dependency file is working as expected? 

    Have you performed the Quick Repair and Rebuild after implementing this logic and permissions of this file are there as expected by Sugar and can you please also tell me what version of Sugar you are using?

Reply
  • Hi Sandeep,

    In your first question, you have mentioned it is working in create view but not for record view. But the screenshots you have provided are for creat view. dependency code looks fine, the other logic used in this dependency file is working as expected? 

    Have you performed the Quick Repair and Rebuild after implementing this logic and permissions of this file are there as expected by Sugar and can you please also tell me what version of Sugar you are using?

Children
No Data