Configuring Default Values Conditionally for Attributes
Attribute-Based Configuration allows you to create the dependency for the target attribute if that attribute should conditionally have a default value set. This feature helps provide starting point configurations for the product and reduce the number of clicks for the user.
If you have set a default value of an attribute using numeric expression and you set the default value of the same attribute using Product Attribute Rule, then the attribute will populate the default value that is set by numeric expression. That is, the value mentioned in numeric expression has priority.
Similarly, if you have set a default value of an attribute from Salesforce field and you set the default value of the same attribute using the Product Attribute Rule, then the attribute will populate the default value that is set using the Salesforce field. That is, the value mentioned in Salesforce field has priority.
The default values are set only when the attributes have no value. For example, you have selected None as picklist value. If you have set a value manually in your attribute, then the default value does not override it.
When you are setting the default value for the target field, the following points must be kept in mind.
- The default value for number Data Type must be written as mentioned in the field value.
- The default value for text and picklist Data Type must be written between single quotes.
- The default value for multi-picklist Data Type must be written between single quotes and must be separated by a semicolon without any space.
The following table displays the datatypes on which you can perform this action and the value of Value Expression required.
Action | Datatypes supported | Value Expression | Example |
---|---|---|---|
Default | Number Text Picklist Multi-picklist | The default value. For example, 'RED' | Number: 79 Text: 'Red' Picklist: 'Blue' Multi-picklist: 'Red';'Black' |
For example, Amttus, a leading laptop manufacturer, wants to use the attributes to drive the product selection of their users. A laptop has five attributes: Color, HDD, RAM, Screen Size, and, Fingerprint Reader. The following table describes the products and its attributes.
Product | A-560 | A-560m | A-440 | A-440m | A-320 | A-320m |
---|---|---|---|---|---|---|
Color | Black | Black | White | White | Black | White |
HDD | 1 TB | 2 TB | 500 MB | 500 MB | 1 TB | 1 TB |
RAM | 8 | 16 | 4 | 8 | 8 | 16 |
Screen Size | 14 HD | 14 HD | 15 | 15 HD | 14 | 14 HD |
Fingerprint Reader | Yes | Yes | Yes | Yes | No | Yes |
The following table describes scenarios where you can use this feature.
Scenario | Target Attribute | Value Expression |
---|---|---|
When the user selects 2 TB from Laptop HDD picklist, Laptop RAM must set 16 as the default value. | Laptop RAM | 16 |
When the user selects Black from Color, 1 TB from HDD, 8 from RAM, and 14 from Screen Size, Laptop Fingerprint Reader must set No as the default value. | Laptop Fingerprint Reader | 'No' |
To disallow the value to be changed by a user, create a read-only attribute or make it conditionally read-only. For more information on conditionally making an attribute read-only, refer to Conditionally Make an Attribute as Read-Only.