Welcome to Zuora Product Documentation

Explore our rich library of product information

Zuora CPQ JS global class

Use the reference topic to learn about the classes used in JS global methods.

This method can only be called explicitly by Extensibility Framework.

ProductTimeline Class

ProductTimeline supports the following JS global class extensibility framework.

getRemovedCharges method

This method exposes removed charges available to the Extensibility Framework hooks.

Input

Parameter

Type

Value

timeline

JS object

Timeline to fetch the removed charges.

Return

The return type of this method is an array.

Output

Return Value

Type

Description

charges

Array

The set of charges that were removed in the specific timeline.

Example Code for ProductTimeline

import { LightningElement, api } from 'lwc';
import ProductTimeline from 'zqu/productTimeline';
export default class TestPublicMethodsExtensibilityFramework extends LightningElement {
    @api quoteState;

    @api
    beforeSave() {
        const timelines = this.quoteState.subscription.productTimelines;
        
        for (const timeline of Object.values(timelines)) {
            const versions = timeline.versions;
            const lastIndex = versions.length - 1;
            const latestVersion = versions[lastIndex];
            const amendmentType = latestVersion.record['zqu__AmendmentType__c'];
            let charges;

            if (amendmentType === 'RemoveProduct') {
                charges = ProductTimeline.getRemovedCharges(timeline)
            }
            if(charges) {
                console.log('returnedCharges:', JSON.parse(JSON.stringify(charges)));
            }
        }
    }
}