Implement the field value conversion on a page

Medium
PDF

Example. Add a converter that converts the Name field value to uppercase to the record page of the custom Converters section. The Name field value must remain the same. Display the converted value in the Label type component.

1. Set up the page UI 

  1. Create a custom Converters app based on the Records & business processes template. To do this, follow the guide in user documentation: Create a custom app.
  2. Open the Converters form page page in the working area of the Converters app page.

    The Converters form page page includes the Name field by default.

  3. Add a Label type component to the working area of the Freedom UI Designer.
  4. Click in the action panel of the Freedom UI Designer. After you save the page settings, Creatio opens the source code of the Freedom UI page.

2. Set up the field value conversion 

Configure the business logic in the Client Module Designer. For this example, set up the field value conversion. Convert the value of the Name field on the Validators form page page.

  1. Implement a custom usr.ToUpperCase converter in the converters schema section.

    converters schema section
    converters: /**SCHEMA_CONVERTERS*/{
        /* The custom converter. Converts the value to uppercase. */
        "usr.ToUpperCase": function(value) {
            return value?.toUpperCase() ?? '';
        }
    }/**SCHEMA_CONVERTERS*/,
    
  2. Bind the caption property of the Label element to the $UsrName model attribute in the viewConfigDiff schema section. $UsrName is the value of the Name field. Add the usr.ToUpperCase converter to the $UsrName attribute.

    viewConfigDiff schema section
    viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
    ...,
    {
        "operation": "insert",
        "name": "Label",
        "values": {
            ...,
            /* Bind the usr.ToUpperCase converter to the $UsrName attribute. */
            "caption": "$UsrName | usr.ToUpperCase",
            ...
        },
        ...
    }
    ]/**SCHEMA_VIEW_CONFIG_DIFF*/,
    
    Complete source code of the page schema
  3. Click Save on the Client Module Designer's toolbar.

Outcome of the example 

To view the outcome of the example:

  1. Open the Converters app page and click Run app.
  2. Click New on the Converters app toolbar.
  3. Enter "Converter's name" in the Name field.

As a result, when you fill out the Name field on the converter page, Creatio will convert the field value to uppercase and display it in the Label type component. The Name field value will remain the same.