Set edit button disabled when parent record has certain state

Hi, 

I want to create a dependency that sets the edit button to readonly when the parent case has a certain state. I came up with the following but it doesn't seem to work. Any idea's?

<?php

$dependencies['Documents']['DisableEditModeIfCaseClosed'] = array(
    'hooks' => array("view"),
    //Optional, the trigger for the dependency. Defaults to 'true'.
    'trigger' => 'and(equal(related($cases,"status"),"Closed"),equal(related($cases,"type"),"Behandelen Verzoek Sport"))',
    'triggerFields' => array("edit_button"),
    'onload' => true,
    //Actions is a list of actions to fire when the trigger is true
    'actions' => array(
        array(
            'name' => 'ReadOnly',
            //The parameters passed in will depend on the action type set in 'name'
            'params' => array(
                'target' => 'edit_button', //edit button name
                //id of the label to add the required symbol to
                'label' => 'LBL_EDIT_BUTTON_LABEL',
                //Set required if the status is closed
                'value' => 'true' // base on selected value button will be ReadOnly
            )
        ),
    ),
    //Actions fire if the trigger is false. Optional.
    'notActions' => array(),
);

for the time being I 'fixed' it with a controller.js customisation but that isn't really the way I would like to solve it

Parents Reply Children
No Data