Welcome to Zuora Product Documentation

Explore our rich library of product information

Update quote state by using ZQFClient helper methods

Learn how to use ZQFClient helper methods to update quote fields, products, or charges by creating and dispatching mutation events.

When you use mutation helpers, remember that they return CustomEvent objects. Your code must explicitly dispatch those events.

  1. Create a ZQFClient instance from quoteState.
  2. Choose the helper method based on the type of update you want to perform:
    • Use updateQuote(...) or updateQuoteField(...) to update quote fields.

    • Use addProducts(...) or addProductsInInterval(...) to add new sellable products or rate plans.

    • Use charge helpers only when the target rate plan already exists in the quote.

    • Use bulk or grouped update helpers when you need to update several records together.

  3. Call the selected helper method to create the event.
  4. Dispatch the returned event by using this.dispatchEvent(...).

    Example: update quote fields

    this.dispatchEvent(
      zqf.updateQuote({
        Name: 'Updated Quote Name',
        zqu__Billing_Region__c: 'EMEA'
      })
    );
    

    Example: update charges in a selected interval

    const updateProductsEvent = qs.updateChargesInInterval(2, [
      {
        filter: (charge) => charge.record.Name === 'Per MB Charge',
        update: { zqu__Discount__c: 20 }
      }
    ]);
    
    this.dispatchEvent(updateProductsEvent);
    

    For more information, see ZQFClient helper methods.

Depending on the helper method that you use, the returned event type is addproducts, updatequote, or updateproducts.