I am trying to extend the var defs on on a an existing definition.
but when I try to do a repair and rebuild it fails
$dictionary['Note']['fields']['name'] = array_merge(
$dictionary['Note']['fields']['name'],
[
'placeholderLabel' => 'LBL_PLACEHOLDER_NOTE_SUBJECT',
'errors' => [
'required' => 'LBL_NOTE_SUBJECT_REQUIRED',
'length' => 'LBL_NOTE_SUBJECT_LENGTH',
],
]
);
is this not possible.
No idea, but try out this:
if (isset($dictionary['Note']['fields']['name']) && is_array($dictionary['Note']['fields']['name'])) {
$dictionary['Note']['fields']['name']['placeholderLabel'] = 'LBL_PLACEHOLDER_NOTE_SUBJECT';
$dictionary['Note']['fields']['name']['errors'] = [
'required' => 'LBL_NOTE_SUBJECT_REQUIRED',
'length' => 'LBL_NOTE_SUBJECT_LENGTH',
];
}
We are allowed to extend the vardefs. For more please refer, Extension Framework :: SuiteCRM Documentation
The above code should work by creating a new file vardefs.php in a directory custom\Extension\modules\Notes\Ext\Vardefs and add the key values like for example $dictionary['Note']['fields']['name']['required']=true;
.
I think you want to have custom error messages while validating the inputs. For this you may refer
Thanks for the making me understand the example. I tried something similar to your field at my end in 8.8 version. You can change according to 8.7 to see if it helps. Sharing the steps here based on my learning.
Copy config/services/ui/ui.yaml at extensions\defaultExt\config\services\ui\ui.yaml and add a new regex (siren).
validations:
regex:
phone: "^([\\+]?|00)((([(]{0,1}\\s*[0-9]{1,4}\\s*[)]{0,1})\\s*)*|([\\-\\s\\./#x0-9])*)+$"
email: '^(?:[\.\-\+&#!\$\*=\?\^_`\{\}~\…