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', ), ), ), );
Make SugarCRM Field Read-Only Dynamically
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
Work with Scriptbaker
Let's talk about your project
Whether you're extending an existing platform, modernising legacy code, or planning something new, our engineers can help. Tell us what you're working on and we'll explore a practical technical solution together.
Related posts
SugarCRM
Fetch Records from a SugarCRM Module via 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
Parse Salesforce & Migrate to 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
Learn how to change the SugarCRM application logo step by step using the administration panel. This guide covers logo requirements, image formats, dimensions, troubleshooting, customization tips, FAQs, and best practices for branding your SugarCRM installation.