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

 

Like 0

Like

1 comments

Hello Laura,

The described situation reminds me that you may apply changes to the unauthorized window. If you relogging into the application - you have to close the Code editor page and open it again after each new login, then changes will be applied.

Please try to modify the code according to the given recommendations and reply to my message if the error persists with additional details about the Error you see.

Show all comments

Creatio by default allows a user to choose between 50, 250 and 500 as max lengths of a Text column from the Object designer. In a use case where Creatio co-exists with an external system and both share the same fields, it becomes important to maintain consistency with respect to data types and lengths.



Right now, the only way to enforce a custom length (say String(8)) is to implement field validators on the Creatio GUI and write custom code to validate any input received via server side integrations. However, the field in the DB would still have 50, 250 or 500 as the length. This is not ideal. 

 

It would be very useful to permit defining custom lengths of fields Eg String(8) from the Object designer which directly creates those custom lengths in the database. 

1 comments

Hello Shrikanth,

 

Hope you're doing well.

 

Thank you for being interested in the Creatio application and further its improvements. We have created a functional request and passed it to our R&D team. After additional review, if the request will be in high demand this kind of functionality will be implemented in the future versions of the application and the users will be able to permit defining custom lengths of the needed fields without adding the custom code.

 

We appreciate your cooperation!

 

Best regards,

Roman

Show all comments

Hello



Creatio by default allows a user to choose between 50, 250 and 500 as max lengths of a Text column from the Object designer. We have a use case where we have to set a specific max length for a field Eg Text (80 charecters). Find below a few questions in this regard 

1. Is there a way to set this custom max length for that object from the Creatio GUI?

2. If #1 is not possible, Can this be set directly at the database/data model layer? If Yes, How? Also, will such a limit automatically bubble upward to the UI? ie If the field is set to 80 charectars and an input field is linked to it, Does a validation of max 80 charectars on the UI automatically apply?

3. The following link provides guidelines on how to custom implement an input validation on the UI. Will such a validation also work on Creatio Mobile?

Like 0

Like

4 comments

Hello. Would really appreciate some help on this question

M Shrikanth,

 

1. There is no way to set the custom max length for a field from the Creatio GUI.

 

2. It's possible to set the custom max length for a field via development by creating a field validator. Please find the examples in the article on Academy:

https://academy.creatio.com/documents/technic-sdk/7-15/how-add-field-validation?_ga=2.27542716.1082264901.1584023961-1276886288.1584023961

 

3. The validation functionality must be developed in the mobile application separately. You need to create a custom business rule in the mobile for that. The guidelines can be found in the article on Academy:

https://academy.creatio.com/documents/technic-sdkmob/7-15/custom-business-rules-mobile-application

Hello

Creatio by default allows a user to choose between 50, 250 and 500 as max lengths of a Text column from the Object designer.

1. Is there a way to set this custom max length for that object from the Freedom UI?

Ahamed Rizlan,

 

Hello,

 

On the object level it's not possible however field validator can be used on the page where the field is added to ensure the value has a specific length and prevent saving when the field length is greater than some value. Here is an article regarding field validators in Freedom UI.

Show all comments