I want to make all fields/the entire record readonly once the sales stage is "Closed Won" and the user is not an administrator.
<?php
global $current_user;
$dependencies['Opportunities']['lock_opportunity_dep'] = array(
'hooks' => array("edit"),
'trigger' => 'and(equal($sales_stage, "Closed Won"),equal($current_user->is_admin, true))',
//'triggerFields' => array('sales_stage'),
'onload' => true,
'actions' => array(
array(
'name' => 'ReadOnly',
'params' => array(
'target' => 'description',
'value' => 'true',
),
),
//.. all other fields here...
array(
'name' => 'ReadOnly',
'params' => array(
'target' => 'name',
'value' => 'true',
),
),
),
);
The above does not work; when I remove the admin check, the fields are locked correctly, so it appears $current_user cannot be used as part of the trigger because it is not a field in the Opportunity module.