Welcome to Zuora Product Documentation

Explore our rich library of product information

Product selector JavaScript plugin

Use this topic to learn about Product Selector JavaScript Plugin in Zuora Quotes.

In Zuora Quotes, you can implement a custom JavaScript plugin to programmatically set values of the standard and custom fields on the charge rows in the Lightning Guided Product Selector. When you write a custom JavaScript file that implements predefined functions and upload that file into Salesforce, Zuora Quotes executes the custom code when your user updates a value on a charge line item in the Product Selector.

Note:

The JavaScript plugin is only available in the new Lightning Guided Product Selector of the version 7.0 and later. The Titanium Product Selector does not support the JavaScript plugin.

Update Charge

Signature

zquGlobalPlugin.updateZCharge(zCharge)

Description

The zquGlobalPlugin.updateZCharge method triggers an update of the field values on the input parameter charge as below:

  • Non-pricing fields on the input Quote Rate Plan Charge. You can update multiple non-pricing fields with the plugin. Updating these fields do not trigger a recalculation of the price.

  • One pricing field at a time

The plugin can set one of the following field values on the Quote Rate Plan Charge object. Setting these fields will trigger a recalculation.

  • Quantity

  • Discount

  • Effective Price

  • Total

The zquGlobalPlugin.updateZCharge method will return an error if more than one pricing field was updated between the current charge and previous version of the charge.

Number of pricing fields updated

Behavior

2

Throws an error "Multiple pricing fields updated on zCharge {zCharge.Id}: {zCharge.Name}"

1

Updates the pricing field in addition to custom field and non-pricing fields

0

Updates custom fields and non-pricing fields

  • If the Orders feature is enabled in your org, the updates by the plugin trigger a cascade recalculation against future segments of the charge.
    Note: This feature is only available if you have the Orders feature enabled.

Post Recalculation

Signature

ProductSelectorPlugin.postRecalculateZCharge(

previousCharge,

currentCharge,

zChargeGroup,

quote,

allChargeGroups)

Description

In your JavaScript plugin, define ProductSelectorPlugin.postRecalculateZCharge and make the call to the zquGlobalPlugin.updateZCharge method inside the function.