disable edit button base on drop-down value sugar Enterprise is that possible.

Hi,

I want disable edit button for my custom module base on drop-down field.

I Need quick help for this .

I would appreciate all the help you could give me. 

Parents Reply
  • Hello paulm,

    I hope you doing good.

    Yes in sugarCRM Enterprise that is possible using sugar dependency. I have done this kind of customization.I have share my code with you.Follow the below step.

    1.create file in following location './custom/Extension/modules/<module>/Ext/Dependencies/<file>.php' and set module and your condition.

    <?php
        $dependencies['<module>']['<unique name>'] = array(
            'hooks' => array("edit"),
            //Optional, the trigger for the dependency. Defaults to 'true'.
            'trigger' => 'true', 
            'triggerFields' => array('status'), //dropdown field name 
            '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' => 'equal($status, "Closed")' // base on selected value button will be ReadOnly
                    )
                ),
            ),
            //Actions fire if the trigger is false. Optional.
            'notActions' => array(),
        );
    

    2.Do Quick Repair and Rebuild.

    For more detail check below links.

    http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.6/Sugar_Logic/Dependency_Actions/

    http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.6/Extension_Framework/Dependencies/

    I hope this will help you.

    -BPATEL

Children