Skip to main content

QAmendment Class

Zuora

QAmendment Class

This article describes the properties and the global methods in the QAmendment class. The QAmendment class is:

  • Designed to minimally represent the QuoteAmendment objects.
  • Used to interface with the QuoteAmendment objects in the CPQ X.
  • Used to track the state of the associated QPlan.

QAmendment Class Properties

The QAmendment class includes the following properties.

Property Type Description
parentPlan QPlan

The associated QPlan object.

QAmendment Global Methods

The QAmendment class includes the following global methods.

Method Type Description
get(String fieldName) Object

Retrieves a field value from the QuoteAmendment record.

getParentPlan QPlan Retrieves the parent QPlan reference of the QAmendment record.
getRecord QuoteAmendment__c Retrieves the QuoteAmendment instance that the QAmendment represents.
isChanged Boolean

Returns true if the state of this record is different from what is last retrieved from DB.

isSaved Boolean

Returns true if this record has been inserted into the DB.

put(String fieldName, Object value) Object

Sets a field value on the QuoteAmendment object. Returns the previous field value.

Amendment Type

An important feature of the QAmendment is that you can use it to track the state of the associated QPlan. 

Amendment Type State Description
NewProduct Describes a QPlan that has been added to the Quote.
UpdateProduct Describes an Original QPlan that has been updated.
RemoveProduct Describes an Original QPlan that has been removed.
Original Describes that the associated QPlan is an existing QPlan that has been carried over to an Amendment or Renewal Quote.

Sample Code

Update Contract Effective Date on QAmendment

The following sample code shows how to change the Contract Effective Date on the QuoteAmendment object through the QAmendment.

public void test(zqu.QAmendment amendment) {
    // Get Initial Value
    System.assertEquals(Date.today(),
                        (Date) amendment.get('zqu__ContractEffectiveDate__c'));
    System.assertEquals(false, amendment.isChanged());
  
    // Update Contract Effective Date
    amendment.put('zqu__ContractEffectiveDate__c', Date.today().addMonths(6));
    System.assertEquals(Date.today().addMonths(6),
                        (Date) amendment.get('zqu__ContractEffectiveDate__c'));
    System.assertEquals(true, amendment.isChanged());
}