Last active
January 12, 2017 19:51
-
-
Save Kobedinho/539323f4acf476fa49833ab21416d2f4 to your computer and use it in GitHub Desktop.
read only fields with dependencies, put the following code in: /custom/Extension/modules/<module>/Ext/Dependencies/custom_readonly_fields_logic.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Documentation.- http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.7/Architecture/Sugar_Logic/Dependency_Actions/ | |
$dependencies['Meetings']['readonly_fields'] = array( | |
'hooks' => array("edit"), // values : "edit", "view", "save" and "all" | |
'trigger' => 'equal($status,"Held")', //Optional, the trigger for the dependency. Defaults to 'true'. | |
'triggerFields' => array('status'), // The list of fields to watch for change events. When changed, the trigger expressions will be recalculated. | |
'onload' => true, // Whether or not to trigger the dependencies when the page is loaded. | |
//Actions is a list of actions to fire when the trigger is true | |
// You could list multiple fields here each in their own array under 'actions' | |
'actions' => array( | |
array( | |
'name' => 'ReadOnly', // actions: ReadOnly, SetOptions, SetPanelVisibility, SetRequired, SetValue, SetVisibility | |
//The parameters passed in will depend on the action type set in 'name' | |
'params' => array( | |
'target' => 'status', | |
'value' => 'true', | |
), | |
), | |
), | |
// The list of dependencies to execute when the trigger expression is false | |
'notActions' => array( | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actions:
ReadOnly.- Is used to determine if a field is editable or not based on a formula.
SetOptions.- Is used to set the options list of a dropdown field based on a formula.
SetPanelVisibility.- Is used to determine the visibility of a record view panel based on a formula.
SetRequiredThe.- Is used to determine if a field is required.
SetValue.- Is used to set the value of a field based on a formula.
SetVisibility.- Is used to determine the visibility logic of a field based on a formula.