Configuring dynamic required attributes

This content applies to version 5.3.1 or later. By default, the dynamic required attributes feature is disabled. You manually edit the pt.cfg file to enable the feature. Then, you set your rules in the dynamic_required_attribute_config.json file.

Before you begin

Dynamic required attribute rules can be defined only for the CCM_LISTBOX and CCM_TOGGLE web types.

Procedure

  1. In the CHANGE_APP_HOME/WEB-INF/wsconfig directory, open the pt.cfg file and locate these lines:

    [CCM_SYSTEM][ENABLE_DYNAMIC_REQUIRED_ATTRIBUTE]false[/ENABLE_DYNAMIC_REQUIRED_ATTRIBUTE][/CCM_SYSTEM]

  2. Change the value to true to enable the dynamic required attributes feature, and then save and close the file.
  3. In the CHANGE_APP_HOME/WEB-INF/wsconfig directory, open the dynamic_required_attribute_config.json file and set your rules.

    Here is the data structure (JSON format) for setting your dynamic required attributes rules:

    [
        {
            "attribute_name":"<name_of_the_attribute>",
            "lifecycle":"<lifecycle_name>",
            "rule":[
                {
                    "value":"<value1_of_the_attribute_above>",
                    "req_attributes":[
                        <list_of_attribute_names_as_comma_separated_values>
                    ]
                },
                {
                    "value":"<value2_of_the_attribute_above>",
                    "req_attributes":[
                        <list_of_attribute_names_as_comma_separated_values>
                    ]
                }
            ]
        }
    ]

    Here is an example of how to set your dynamic required attribute rules:

    [
        {
            "attribute_name":"product_name",
            "lifecycle":"Default Lifecycle",
            "rule":[
                {
                    "value":"Product A",
                    "req_attributes":[
                        "browser",
                        "browser_version"
                    ]
                },
                {
                    "value":"Product B",
                    "req_attributes":[
                        "OS",
                        "OS_version"
                    ]
                }
            ]
        }
    ]
    Attention:

    If you make any file format errors, the system cannot recognize the file.

  4. Save and close the file, and then reload your configuration data.

Feedback