Tag: CPQ Cloud

How to create a new version attribute in commerce?

  1. Create a new commerce action of type version.  Creating it will create an internal commerce attribute of type string which will maintain version when clicked. The name of this variable is dynamic and will depend on the name of the commerce action. Typical name of the attribute is ‘version_number_versionTransaction_t. Note that this attribute is not visible in the commerce attribute listing but would be visible when you create a commerce util function. Try to search for version_ in the util to find this newly created internal attribute. The Default value of this attribute is  blank and increments to 2 when clicked for the first time. When we click on it next it will become 3 and then 4 and then so on.
  2. Write a commerce function with name say version() which gets the value of this variable in integer as follows
if(version_number_versionTransaction_t <> "") {

                return atoi(version_number_versionTransaction_t);

                } else {

                return 1;

}

3. Create a new attribute to capture version with name say version_t of type integer. Default it to the following BML snippet

return commerce.version();

4. You would like this attribute to get evaluated again when you click on version action everytime so that this attribute always shows the correct value on the UI