Skip to content

Instantly share code, notes, and snippets.

@dmulvi
Created April 22, 2015 18:46
Show Gist options
  • Save dmulvi/7106421794735b77bed3 to your computer and use it in GitHub Desktop.
Save dmulvi/7106421794735b77bed3 to your computer and use it in GitHub Desktop.
Make a field readonly in SugarCRM
<?php
/* This will make a field readonly. Create this file here:
/custom/Extension/modules/MODULE/Ext/Dependencies/
and then Quick Repair/Rebuild */
$dependencies['MODULE']['FIELD_NAME_readonly'] = array(
'hooks' => array('edit'),
'trigger' => 'true',
'triggerFields' => array('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' => 'FIELD_NAME',
'value' => 'true',
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment