Knowledge Center

Knowledge Center > Commerce > Zuora Quotes > Zuora Rules Engine > Create Zuora Rules

Create Zuora Rules

Zuora Rules Structure

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

  • Header Information: Includes rule name, description, priority, and active flag.
  • Condition: Defines the condition that must be met for the rule to be triggered.
  • Actions: Defines what should happen when the rule is triggered.

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.

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.

Create a Rule in Zuora Quotes

To create a rule in Zuora Quotes:

  1. In the Rules tab, click New or New Rule.
  2. In the RULE section, specify the following field values. 
    • Name: Specify a name to identify this rule. The name of each rule must be unique in your org.
    • Active: Select to activate the rule and have it applied to the quoting process. You can create a rule without initially activating it.
    • Description: Give a description of what the rules does. 
    • Priority: Specify an ordinal number. A rule with the higher Evaluation Priority value is evaluated after a rule with the lower Evaluation Priority value.
  3. In the CONDITION section, click Add Criteria... and specify the following field values.
    1. Conjunction: Toggle between OR and AND to join condition criteria.
    2. Attribute Type of the first operand: Click and select a type. The next input fields depend on the type you select in this field.
      • System Value: Select the Profile, User Role, or User object first. Then select a Field on the that object to filter on.
      • Calculated Value: Click -Select Value- to specify a predefined Formula or create a new Formula.
      • Rollup Value: Select the Object and Rollup Type fields.
      • Object Field Value: Click and select a field on the Quote object. To select a field on the Account, Contact, or Opportunity object, select the lookup reference, e.g. Account >.
    3. Comparison Operator: Click is equal to and select a comparison operator.
    4. Attribute Type of the second operand: Click and select a type. The next input fields depend on the type you select in this field.
      • System Value: Select Profile, User Role, or User object first. Then select a field on the selected object.
      • Calculated Value: Click -Select Value- to specify a predefined Formula or create a new Formula.
      • Rollup Value: Select the Object and Rollup Type fields.
      • Object Field Value: Click and select a field on the Quote object. To select a field on the Account, Contact, or Opportunity object, select the lookup reference, e.g. Account >.
      • Static Value: Specify a constant for the first operand to be compared against.
    5. Click Add Criterion... if you want to add another condition criterion.
  4. In the ACTIONS section, click Add Action... and specify the following field values. A rule can have one or more actions.
    1. In the Action Type field, click and select a type of action to trigger when the above condition met.
      • Update Product
        • Object: Select the object to be updated.
        • Field: Select the field to be updated.
        • Filter: Optionally, click No Filter to select a predefined filter or to create a new filter. This further filters the records to be updated.
        • New Value Type: Select the value type. See above for the description of each value type.
        • Message: Specify the text to be displayed to the user when this action executes. This field value is optional.
      • Remove Product
        • Filter: Optionally, click No Filter to select a predefined filter or to create a new filter. This filter defines which rate plans are to be removed from the quote.
        • Message: Specify the text to be displayed to the user when this action executes. This field value is optional.
      • Add Product
        • Product: Select a product to be added.
        • Rate Plan: Select a rate plan to be added.
        • Removal Behavior: Click and select one of the following options to instruct the Rules Engine what to do when a user tries to remove the product added to a quote by this rule. Your selection is not preserved when the quote is saved. All products on a quote will be re-evaluated when the page is refreshed.
          • Remove and Re-Add: First, the product is removed from the quote, and the rule condition is re-evaluated. If the rule condition is still true, the product is added back to the quote.

          • Require: The product added by this rule cannot be removed by a user. The product can only be removed by other rules.

          • Remove: When a user removes the product added to a quote by this rule, the product is removed from the quote and is not added back to the quote even by another rule. 

        • Allow Immediate Price Action: Select to allow the details of the product added by this action be manipulated by rules that happen immediately after. For example, if you want to add a product then immediately set its price with another action. Gathering the details of added charges has a performance cost, so we recommend using this option only when absolutely necessary.
        • Message: Specify the text to be displayed to the user when this action executes. This field value is optional.
      • Show Validation Message
        • Message Type: Select the message type.
          For the Error type messages, users will not be able to save or submit a quote if the rule condition is evaluated to be true.
          The Info and Warn type messages display informational messages to the user.
        • Message: The text to be added to the log. 
      • Custom Action
        • ​​​​​​​​​​Class Name: Specify the class name of your Custom Action Plugin that you have implemented.
        • Attribute: The key name of the attribute as defined in the Custom Action Plugin. The key name must match as defined in the plugin code.
        • Value: The values for the attribute key. 
    2. Click Add Action... if you want to add another action for the rule.
  5. Click Save to save the rule and exit. Or Click Quick Save to save the rule and stay on the page.

Create a Filter Condition

To create a Filter Condition to be used in rules:

  1. In the Filter Conditions tab, click New or New Filter Condition.
  2. Alternatively, you can create Filter Conditions on the Rules configuration page.
  3. Specify the following field values:
    • Name: Assign a name to identify the filter. This name will appear in Zuora Rules Engine configuration. The name must be unique across all Filter Conditions in your org.
    • Object Type: Select the object this filter is on. 
  4. In the CONDITION section, click Add Criteria... and specify the following field values.
    1. Conjunction: Toggle between OR and AND to join condition criteria.

    2. Attribute Type of the first operand: Click and select a type. The next input fields depend on the type you select in this field.

      • System Value: Select Profile, User Role, or User object first. Then select a Field on the selected object to filter on.

      • Calculated Value: Click -Select Value- to specify a predefined Formula or create a new Formula.

      • Object Field Value: Click and select a field on the object you selected in the Object Type field.

    3. Comparison Operator: Click is equal to and select a comparison operator.

    4. Attribute Type of the second operand: Click and select a type. The next input fields depend on the type you select in this field.

      • System Value: Select Profile, User Role, or User object first. Then select a field on the selected object.

      • Calculated Value: Click -Select Value- to specify a predefined Formula or create a new Formula.

      • Object Field Value: Click and select a field on the object you selected in the Object Type field.

      • Static Value: Specify a constant for the first operand to be compared against.

  5. Click Add Criterion... if you want to add another condition criterion.

  6. Click Save to save the filter condition and exit. Or Click Quick Save to save the filter condition and stay on the page.

Determine Whether a Rate Plan Charge is Added, Updated, or Original on a Quote 

You can create a Filter Condition to query the Amendment Type field (zqu__AmendmentType__c) on Quote Rate Plan (zqu__QuoteRatePlan__c) to determine whether a charge is new, updated, or original. The values you can query in filter conditions are:

  • NewProduct: This rate plan was added on a new subscription quote or as a new product on an amendment quote.
  • UpdateProduct: This rate plan was updated on an amendment quote.
  • OriginalProduct: This is an existing rate plan that has not been changed on an amendment quote.

Create a Calculated Value

To create a Calculated Value to be used in rules:

  1. In the Calculated Values tab, click New or New Calculated Value.
  2. Alternatively, you can create Calculated Values on the Rules configuration page.
  3. Specify the following field values:
    • Name: Assign a name to identify this calculated value. This name will appear in Zuora Rules Engine configuration. The name must be unique across all Calculated Values in your org.
    • Object Type: Select the object this calculated value is applied to. You can create calculated values on the Quote, Rate Plan, Charge, and Feature objects.
  4. In the FORMULA section, click Add Input... and specify the following field values.
    1. Operator: Click Add to select the calculation method. Add, Subtract, Multiply, and Divide are supported.
    2. Input Type: Click and select a type. The next input fields depend on the type you select in this field.

      • Static Value: Specify a numeric constant that this calculated value always returns.

      • System Value: Select the User object first. Then select a Field on the selected object to grant access to specific users to use this calculated value.

      • Rollup Value: Select the Object and Rollup Type fields.

        • Optionally, click No Filter in the Filter field to select or create a filter. 
      • You can create filters in the Filter Conditions tab prior to this step.

      • Object Field Value: Click -Select Field- to select a field on the base object you selected in the Object Type field. Click Select to choose the field.

  5. Click Save to save the calculated value and exit. Or Click Quick Save to save and stay on the page. 
Last modified
11:20, 29 Nov 2016

Tags

This page has no custom tags.

Classifications

(not set)