Welcome to Zuora Product Documentation

Explore our rich library of product information

Zuora Rules structure

Zuora Rules Engine allows you to define rules with components such as header information, trigger events, conditions, and actions to automate processes within the Quote Studio UI.

A rule in Zuora Rules Engine consists of the following components:

  1. Header Information: Includes rule name, description, priority, and active flag.
  2. Trigger Event: Defines specific trigger events that must be met to trigger the rule.
  3. Condition: Defines the condition that must be met for the rule to be triggered.
  4. Actions: Defines what should happen when the rule is triggered.

Trigger Event

Trigger event refers to the specific event or condition that causes the rule to be executed or triggered. It is the event that initiates the rule's action. The rule is activated when the trigger event occurs, and its associated actions or operations are performed.

The following trigger events are available:

Trigger EventDescription
Trigger Rule whenever criteria for the Rule is metThis is the default trigger event, where the rule will be executed whenever the specified criteria for the rule are met.
Trigger Rule only when Save or Submit buttons are selected in Quote Studio UIWith this trigger event, the rule will be triggered only when you select the Save or Submit buttons in the Quote Studio UI. This allows you to execute the rule at specific points during the quote creation process.
Trigger Rule only when Quote Studio Initially loadsThis trigger event ensures that the rule is executed only when the Quote Studio initially loads. This can be useful for scenarios where you want the rule to be applied when the quote is first accessed or opened.

It is important to note that upgrading from Version 10.19 to 10.20 might require additional attention. The default trigger event for existing rules may be set to null, potentially affecting their functionality.

To ensure a smooth transition and proper functioning of your existing rules when upgrading from Version 10.19 to 10.20, we recommend performing the following steps:

You can execute the provided code snippet in the developer console to default the trigger event value for your existing rules. This adjustment will ensure your rules continue operating as intended within the enhanced rules engine framework.

List<zqu__ZRule__c> zRuleList = [SELECT Id, Name, zqu__TriggerEvent__c FROM zqu__ZRule__c WHERE zqu__TriggerEvent__c = null];
for (zqu__ZRule__c zRule : zRuleList) {
if (zRule.zqu__TriggerEvent__c == null) {
zRule.zqu__TriggerEvent__c = 'Everytime';
}
}
update zRuleList;
Note:

If you are upgrading from version 10.19 to 10.21 or later, you do not need to manually run the code. The system will handle this process automatically for you

Condition

A Condition is a set of evaluation criteria that operates on a set of data. A Condition determines whether the Actions of the rule should execute.

In the Rules tab, you set up one Quote-level condition for each rule. For example, Add a Support Product if there are three or more Software plans.

A Criterion in a Condition is made up of Conjunctions and Comparisons.

  • Conjunctions: The AND and OR operators to join two or more Criteria.
    • If a Condition is made up of criteria joined by AND, the rule will execute if ALL of the criteria are true.

    • If a Condition is made up of criteria joined by OR, the rule will execute if ANY of the criteria are true.

  • Comparison: A basic operation of comparing one value to another. A comparison is comprised of a left term, a relational operator, and a right term.
    • The left term and right term are Values.
    • The left term can be compared to the right using one of the following:
      • is equal to
      • is not equal to
      • contains
      • does not contain
      • is null
      • is not null
      • is less than
      • is greater than
      • is less than/equal to
      • is greater than/equal to

Values

Values are the units being compared in Comparison criteria. Both the left and right side operands of each Comparison must contain a value. The following types of Values are supported:

  • Static Value: A value that you specify when the rule is configured. This value does not change.
  • Object Field Value: References a field on the Quote object. At runtime, the value is retrieved from the object field, e.g. Quote.Type.You can also reference a field on any object in the parent hierarchy of the Quote object, e.g. Quote > Opportunity > Account.Industry.
  • Rollup Value: A calculated value that performs an aggregation operation against a collection of records at runtime. For example, Sum of all Prices on Charges with Type 'Software'.
    • A Rollup Value can aggregate values on the Rate Plans, Charges or Features related to the Quote.

    • Rollup Values can be referenced in either calculated values or comparisons and are used to aggregate values based on a collection of data.

    • Operation determines which function to apply against the collection. This can be Count, Sum, Average, Min, Max

    • Rollup Values can make use of a Filter Condition to roll up only a subset of objects. See the Filter Conditions section below.

  • Calculated Value: Values resulted from arithmetic operations against two or more values at runtime. Calculated values can reference any combination of other types of values or arithmetic operations, except for other Calculated Values. For example, 10% of the sum of Hardware and Software charges.
  • System Value: System Values refer to the current users' Profile, User Role, or User information. They can be used to filter which Rules apply to which types of User.
  • Lookup Value: A Lookup value derives a number value by looking up a record of a reference table based on one or many attribute values.
    • Lookup Object Name indicates the custom object that will be used as the lookup table. This object must contain at least one number field.
    • Value Field Name should be set to a number field, which will be the return value of the looked-up record.
    • One or many Attribute values can be set to determine which record of the Lookup object will be used as the value.
    • During rule execution, the value set on each attribute will be evaluated to filter down to one record of the Lookup object, which will be the value of the Value field.
    See Use Case: Setting a Multi-Attribute Price.

Filter Conditions

For actions or aggregations that operate against the Rate Plan, Charge, or Quote Product Feature of the selected Quote, additional child-level Filter Conditions can be set up in the Filter Conditions tab or on the Rules configuration page. Example Filter Conditions could be "Calculate the sum of prices of all charges where Type is Hardware" or "Update all charges where discount is greater than zero".

Actions

A rule has one or more Actions. Each action describes something that should happen when the rule is run. Actions are configured with different attributes depending on the Action type. The supported Action types are:

  • Add Product: Adds a new rate plan to the quote.
  • Remove Product: Removes a rate plan from the Quote.
  • Update Product: Updates a field value of the products matching certain criteria.
  • Show Validation Message: Shows a message that alerts users about invalid conditions in their quote. For the Error type validations, the quote cannot be saved or submitted until the error condition is resolved.Info and Warning messages can also be configured that alert the user, but do not prevent it from saving the quote.
  • Custom Action: Use the Custom Action Plugin to define additional rules actions you want the Rules Engine to perform.