You are here: Best Practices > Naming Conventions for Rules, Attributes, and Variables

Naming Conventions for Rules, Attributes, and Variables

OVERVIEW

Engineers, architects, and admins have free reign over what they name rules, functions, documents, attributes, and internal variables. However, it is imperative that all of these aspects of an implementation are given clear, useful, and at least semi-standardized names. Consistent and clear naming supports maintenance and add-on activities. Well-named Rules and Attributes are easier to identify, and code that uses well-named variables and functions is self-documenting.

Naming opportunities are ubiquitous across CPQ Cloud:

ADMINISTRATION

ClosedNaming Convention Rules

The name of a configuration rule should give an admin some insight as to what the rule does. Wherever possible, use names that evoke the business rules being implemented, using the terminology and language that the customer is familiar with. Remember, there are a number of attributes of rules stored as metadata, so it is not necessary to recapitulate them in the naming and it can clutter the UI if you do:

ClosedRecommendation Rules

ClosedConstraint Rules

ClosedHiding Rules

ClosedRecommended Item Rules


ClosedNaming Functions

Each function should have a meaningful name that accurately conveys what it does. Function/method names should start with a strong action verb, such as convert, divide, build, and so on. Get and set are often used in function names. The rest of the name should reference what the function is acting on or perhaps what it is returning. Examples include:


ClosedNaming Documents

There are two primary types of documents in CPQ Cloud:


ClosedNaming BML Variables

Often the sheer number of variables in BML scripts causes admins to give little thought to the variable names. Poorly chosen names can make code difficult or impossible to read.

The following table describes types of BML variables:


ClosedNaming Attributes

Follow the preceding recommendations for variables when naming Configurable and Commerce Attributes. In addition, you should follow a naming convention that makes it easier to distinguish between Attributes and regular variables in a script, since they behave differently. For example, you cannot set the value of an Attribute in a script.

The following examples show "_object" convention used in QuickStart:


ClosedNaming Data Tables

To more easily distinguish between variables, use Capitalized CamelCase when naming Data Tables. Example:


NOTES

RELATED TOPICS

Related Topics Link IconSee Also