Defining Advanced Rules Using Attribute Configuration Type

You can define advanced rules using the product configuration procedure and you can use advanced rules to create entity filters.

Consider the following use case: You have an Apple iPhone 11 with two attributes: Color and Capacity.

  • Color = red, blue, or green.

  • Capacity = 128GB, or 256GB, or 512GB.

However, the color red only comes in 256GB and not the other two capacities (128GB and 512GB).

To satisfy the requirement of getting a red Apple iPhone 11 with 256GB:

  1. Create Product Configuration Procedures:

    1. Click App Launcher.

    2. Search for Product Configuration Procedures and click the link.

      For more information on Product Configuration Procedures, see Create Action Parameter JSON with Product Configuration Procedure.

    3. Click New.

    4. Do the following:

      • Enter a Configuration Procedure Name.

      • Select a product (optional).

      • Select an attribute and click the + icon to add it.

      Product Configuration Procedures

    5. Click Add Action and select ASSIGN from the list.

    6. Click Select Options and select an option.

      Product Configuration Procedures - options

      When the product configuration rule runs, you can apply these actions.

    7. Add more actions as needed.

    8. When finished, save your changes.

  2. Create a Vlocity rule:

    1. From the App Launcher, click Vlocity Rules. For more information, see Accessing the Vlocity Rule Builder.

    2. Click New.

    3. Click Edit Mode.

    4. Enter a rule name and a description.

    5. In the first field, select Attributes Configuration.

    6. In the second field, select Order<Order>.

      In the case of advanced rules, order items only apply to the header objects, which means order, quote, or opportunity. For a given basket, the Rule Builder goes through every line item and tries to match the chosen product. If there is a match, it applies the attribute you have selected as part of the Product Configuration Procedure.

    7. Set the rule to Active.

    8. Click Filters and click Add to Rule Filter to add any entity filters that add the attributes on the order object.

    9. Click Actions.

      The name of the Product Configuration Procedure you created appears in the list of actions you can apply for your rule. When you run the Basket APIs and validation rules are triggered, those rules apply the actions you have in the Filters and Actionslist for each line item in the order. For example, if you choose the Apple iPhone 11 in red, then it comes with 256GB capacity.

    10. Repeat the above steps to add more conditions and actions.

    11. When finished, save your changes.

  3. Run the Cacheable API jobs. For more information, see Running Cacheable API Jobs.

  4. Add the offer to the basket:

    1. In your API platform, set the HTTP method to POST and add the offer to the basket:

      Post Basket API request:

      /services/apexrest/vlocity_digital/v3/catalogs/catalogCode/basket

      Post body:

      {"basketAction":"addWithNoConfig","offer": "p1"}

      The response will return the cart context ID. When you add the offer, the actions you defined in Vlocity Rule Builder are applied.

    2. Add the bundle context to the request body, which includes the red color Apple iPhone 11 with 256GB capacity. The response should include the details about that product offering.