Let’s suppose you want to make Mobile field readonly based on Title field’s value in Contacts Module. You can achieve above with SugarCRM Dependencies. Experienced SugarCRM developers already know about Dependencies but if you are not familiar with them, no worries and carry on reading! These are used to add dependent actions to fields and forms that can leverage more complicated logic that is not yet available in Studio. More information about dependency actions can be found in the Sugar Logic section. As mentioned in properties of Dependencies the dependency files should be located in ./custom/Extension/modules/{module}/Ext/Dependencies/{dependency name}.php and be rebuilt with a quick repair after modification. As we are going to add a dependency for Contacts Module we will be creating a dependency file at custom/Extension/modules/Contacts/Ext/Dependencies Inside the file put below code Save the file and do a quick repair and rebuild. The dependency we just created says that the Mobile Phone Field will be readonly if the Title of the person is CTO. This works perfectly in Sugar 6 and seems to partially work in Sugar 7 SugarCRM Dependencies:
Properties:
Internal Name dependencies Manifest Installdef dependencies Extension Directory ./custom/Extension/modules/<module>/Ext/Dependencies/ Extension File ./custom/modules/<module>/Ext/Dependencies/deps.ext.php Adding Dependency to Contacts Module:
$dependencies['Contacts']['phone_mobile_readonly'] = array( 'hooks' => array("edit"), 'trigger' => 'equal($title, "CTO")', //Optional, the trigger for the dependency. Defaults to 'true'. 'triggerFields' => array('title'), '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' => 'phone_mobile', 'value' => 'true', ), ), ), );
SugarCRM
How to make certain field readonly or disabled based on some other field’s value using SugarCRM Dependencies
Let’s suppose you want to make Mobile field readonly based on Title field’s value in Contacts Module. SugarCRM Dependencies: You can achieve above with SugarCRM
· 5 min read
Related posts
SugarCRM
Get list of records from SugarCRM module using REST API
Its very common problem for many people to fetch data from SugarCRM application and feed it to some other application. Using REST API we can easily fetch list o
SugarCRM
How to parse Salesforce tables and put data in SugarCRM?
In previous post you learnt how to create REST API to fetch data from SugarCRM application, in this tutorial you will learn to migrate data from Salesforce to S
SugarCRM
How to change logo of SugarCRM application
After completing installation of SugarCRM community edition, one of the first things you may want to change is the application logo. SugarCRM provides the optio