Skip to main content

Use Case: Using Lookup Value in Rules

Zuora

Use Case: Using Lookup Value in Rules

This use case demonstrates how to use a a Lookup Value within a rule to accomplish the following objectives:

  1. Setting various field values (e.g., Effective Price, Quantity, etc.) for a Product in a Quote by referencing the attribute (e.g., List Price) from a custom object record.
  2. For MAP (Multi-Attribute Price) products, setting the Quantity field of a Product in a Quote using the Quantity attribute from a custom object record.

You can only set the Quantity field exclusively for MAP products. Nevertheless, you have the flexibility to modify various other field values (e.g., Effective Price), including the Quantity field, for products that do not fall under the MAP category.

Setting field values of a product in a quote 

In this example, we will see setting up an Effective Price field in a Quote to the value of the List Price.

Set up Lookup Table Data for the Use Case 

  1. Create a new custom object Price Table Entry with the following fields:
    •   Ownership (Text)
    •   Lead Source (Text)
    •   List Price (Number)
  2. Create one record of Price Table Entry and set the field values as follows:
    •   Ownership: Public
    •   Lead Source: Web
    •   List Price: 99
  3. Optionally, create other records with different values.

Create the Rule 

  1. In the Rules tab, click New and add the following rule.
    1.   Rule Name: Set Price Based on Attributes
    2.   Active: Select the field.
  2. Define a Condition that checks if the Quote has Products.
    1. In the CONDITION section, click Add Criteria....
    2. In the first Attribute Type field, click and select Rollup Value.
    3. In the Object field, click and select Rate Plan.
    4. In the Rollup Type field, click and select Count.
    5. Change the is equal to to is greater than in the pick list.
    6. In the second Attribute Type field, click and select Static Value.
    7. In the Value field, type 0.
  3. Define the Action that sets the Effective Price based on the Price Table Entry records.
    1. In the ACTIONS section, click Add Action....
    2. In the Action Type field, click and select Update Product.
    3. In the Object field, click and select Charge.
    4. In the Field field, click and select Effective Price.
    5. In the New Value Type field, click and select Lookup Value.
      1. In the Lookup Object field, select Price Table Entry.
      2. In the Value Name field, select List Price.
      3. For Attribute 1, select Ownership.
        1. For Attribute Value Type, select Object Field Value.
        2. Click on Object Field, and select Quote > Account > Ownership.
      4. Click the + button next to Attribute 1 to add a second attribute.
      5. For Attribute 2, select Lead Source.
        1. For Attribute Value Type, select Object Field Value.
        2. Click on Object Field, and select Quote > Opportunity > Lead Source.
    6. In the Message field, type "Charge Price updated."
  4. Click Save.

Verify the Rule 

  1. Create or update an Account and set the Ownership value to Public.
  2. Under that Account, create or update an Opportunity. Set the Opportunity's Lead Source value to Web.
  3. Under this Opportunity, create a New Subscription Quote.
  4. In the Guided Selling flow, add a Per Unit product to the quote.
    1. In the Edit Products page, verify that the Effective Price of the product is updated to 99.
    2. The Rules Engine Logs section will show the message "Charge Price updated." that you have specified in the rule.
  5. Optionally, update the Account's Ownership or the Opportunity's Lead Source values to other values that match a Price Table Entry. Refresh the product selection to validate the new effective price matches this Price Table Entry's List Price field.
  6. Note that you must ensure that any valid combination of attribute inputs matches at least one record of the Lookup Object when you use the multi-attribute pricing rule. Otherwise, the price calculation will not be possible.
  7. Lookup Object records can also contain a wildcard character "*" in an attribute field to match against any input value.

(For MAP) Setting "Quantity" field value of a product in a quote 

Set up Lookup Table Data for the Use Case 

  1. Create a new custom object Quantity Table Entry with the following fields:
    •   Ownership (Text)
    •   Lead Source (Text)
    •  Quantity (Number)
  2. Create one record of Quantity Table Entry and set the field values as follows:
    •   Ownership: Public
    •   Lead Source: Web
    •   Quantity: 99
  3. Optionally, create other records with different values.

Create the Rule 

  1. In the Rules tab, click New and add the following rule.
    1.   Rule Name: Set Quantity Based on Attributes
    2.   Active: Select the field.
  2. Define a Condition that checks if the Quote has Products.
    1. In the CONDITION section, click Add Criteria....
    2. In the first Attribute Type field, click and select Rollup Value.
    3. In the Object field, click and select Rate Plan.
    4. In the Rollup Type field, click and select Count.
    5. Change the is equal to to is greater than in the pick list.
    6. In the second Attribute Type field, click and select Static Value.
    7. In the Value field, type 0.
  3. Define the Action that sets the Quantity based on the Quantity Table Entry records.
    1. In the ACTIONS section, click Add Action....
    2. In the Action Type field, click and select Update Product.
    3. In the Object field, click and select Charge.
    4. In the Field field, click and select Quantity.
    5. In the New Value Type field, click and select Lookup Value.
      1. In the Lookup Object field, select Quantity Table Entry.
      2. In the Value Name field, select Quantity.
      3. For Attribute 1, select Ownership.
        1. For Attribute Value Type, select Object Field Value.
        2. Click on Object Field, and select Quote > Account > Ownership.
      4. Click the + button next to Attribute 1 to add a second attribute.
      5. For Attribute 2, select Lead Source.
        1. For Attribute Value Type, select Object Field Value.
        2. Click on Object Field, and select Quote > Opportunity > Lead Source.
    6. In the Message field, type "Quantity updated."
  4. Click Save.

Verify the Rule 

  1. Create or update an Account and set the Ownership value to Public.
  2. Under that Account, create or update an Opportunity. Set the Opportunity's Lead Source value to Web.
  3. Under this Opportunity, create a New Subscription Quote.
  4. In the Guided Selling flow, add a Per Unit product to the quote.
    1. In the Edit Products page, verify that the Quantity of the product is updated to 99.
    2. The Rules Engine Logs section will show the message "Quantity updated." that you have specified in the rule.
  5. Optionally, update the Account's Ownership or the Opportunity's Lead Source values to other values that match a Quantity Table Entry. Refresh the product selection to validate the new quantity matches this Quantity Table Entry's Quantity field.
  6. Note that you must ensure that any valid combination of attribute inputs matches at least one record of the Lookup Object when you use the multi-attribute pricing rule. Otherwise, the calculation will not be possible.
  7. Lookup Object records can also contain a wildcard character "*" in an attribute field to match against any input value.