Hello
I want to set up a validator in the field when the length is greater than 10 characters, it does not allow saving that record. To achieve this I am basing myself on the following example: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…
Placing it in the following way but it does not work correctly.
validators: /**SCHEMA_VALIDATORS*/{
/* Implement a custom validator type. */
"usr.ValidateFieldValue": {
/* Business logic of the validator. */
"validator": function (config) {
return function (control) {
return control.MaxLength !== config.invalidLength ? null: {
"usr.ValidateFieldValue": { message: config.message }
};
};
},
/* Validator parameters. */
"params": [
{
"name": "invalidLength"
},
{
"name": "message"
}
],
"async": false
}
}/**SCHEMA_VALIDATORS*/
/**SCHEMA_VIEW_CONFIG_DIFF*/,
viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
{
"operation": "merge",
"path": [
"attributes"
],
"values": {
"UsrnumerodeserieDS_Name_zb3wye6": {
"modelConfig": {
"path": "UsrnumerodeserieDS.Name"
},
/* The property that contains the list of attribute validators. */
"validators": {
/* Custom validator. */
"ValidateFieldValue": {
/* Validator type. */
"type": "usr.ValidateFieldValue",
"params": {
/* The field value that triggers the custom validator. */
"invalidLength": "10",
/* The tooltip that Creatio displays when the field contains the value specified in the “invalidName” property. */
"message": "Invalid name."
}
}
}
}
}
}
Also at some point I modify the code and save it but when I re-enter it does not save the changes and removes what I placed