Hi,
I have checked for existing dependency of sugarcrm readonly but I can only hide one single field instead of I want to perform read only all fields panel wise base on condition.
Any help highly appreciated.
Thanks.
Hi,
I have checked for existing dependency of sugarcrm readonly but I can only hide one single field instead of I want to perform read only all fields panel wise base on condition.
Any help highly appreciated.
Thanks.
Hey Guys,
I got solutions for this.
$parser = ParserFactory::getParser(MB_RECORDVIEW, "Accounts");
$panels = $parser->_viewdefs['panels'];
$fields = $parser->_fielddefs;
$fieldData = array();
foreach($panels as $panelName => $panelData) {
if($panelName != $panel) continue;
foreach($panelData as $panelDataItem) {
foreach($panelDataItem as $fieldName) {
if( !isset($fields[$fieldName]) ) continue;
array_push($fieldData,$fields[$fieldName]['name']);
}
}
}
foreach ($fieldData as $key => $field)
{
$toUnset['dependencies']['Accounts'][$toUnset['counter']++] = array(
'hooks' => array('edit'),
'trigger' => 'true',
'triggerFields' => array('status_c'),
'onload' => true,
'actions' => array(
array(
'name' => 'SetVisibility',
'params' => array(
'target' => $field, -> all fields of panel wise
'value' => $expression, -> condition you want
),
),
),
);
}
}
$dependencies['Accounts'] = array_merge($dependencies['Accounts'], $toUnset['dependencies']['Accounts']); -> set dependency
unset($toUnset); -> unset dependency