Download PDF
Download page Updating Quote Terms.
Updating Quote Terms
This method enables you to update the expected start date and expected end date of the quote, along with its selling term. This method does the following:
- Updates Expected Start Date and Expected End Date for the Quote/Proposal object.
- Retrieves the finalized cart associated with the quote.
- Creates a new cart by checking out the finalized cart.
- Updates Expected Start Date & Expected End Date in the cart object. Note this is for the new Product Configuration cart object.
- Updates Start Date, End Date, and Selling Term on line item terms that have a valid start date, i.e. when the start date is not null.
- Selling Term may be set to null to clear out the existing selling term which triggers a recalculation of the selling term using the start and end dates. Alternatively, if start date and selling term are provided, the end date is automatically calculated.
- Updates the net price and total price for the cart.
- The ID of the new cart is returned to the caller.
- It is the caller's responsibility to finalize the cart.
The field QuoteLineItemColl, which is part of the Apttus_CPQApi.CPQ.UpdateQuoteTermRequestDO, can accept a list of quote line item sObjects which can hold the data to override one or more line items. For this the line items need to have the following fields populated:
- Start Date
- End Date
- Selling Term
- Derived Form
Line items that match the Derived From value gets overridden values from the Quote Line items. The remaining fields will default to values provided in the request object. A null value in the Start Date field in the request will prevent the values from defaulting to the line items from the request object.
API | Signature |
---|---|
updateQuoteTerm | webService static Apttus_CPQApi.CPQ.UpdateQuoteTermResponseDO updateQuoteTerm(Apttus_CPQApi.CPQ.UpdateQuoteTermRequestDO request) |
Parameters | ||
---|---|---|
Name | Type | Description |
request | Apttus_CPQApi.CPQ.UpdateQuoteTermRequestDO | This is the request call made by the method. |
Request Data Object - Apttus_CPQApi.CPQ.UpdateQuoteTermRequestDO | |||
---|---|---|---|
Field | Type | Required | Description |
EndDate | Date | No | The expected end of the quote. |
LineItemColl | Apttus_CPQApi.CPQ.LineItemCollDO | No | The list of line items |
QuoteId | ID | Yes | The Id of the quote you want to change the dates and selling term for. |
QuoteLineItemCollDO | Apttus_CPQApi.CPQ.QuoteLineItemCollDO | No | The collection of Line items to be updated. |
ReCalcSellingTerm | Boolean | No | You can use this method enabled recalculating the selling term |
SellingTerm | Decimal | No | The selling term of the quote is typically measured in years, months, or days. |
StartDate | Date | Yes | The expected start date of the quote. |
Data Object - Apttus_CPQApi.CPQ.LineItemCollDO | ||
---|---|---|
Field | Type | Description |
LineItems | List | The list of line items |
Data Object - Apttus_CPQApi.CPQ.QuoteLineItemCollDO | ||
---|---|---|
Field | Type | Description |
LineItems | List | The list of line items |
Response Data Object - Apttus_CPQApi.CPQ.UpdateQuoteTermResponseDO | ||
---|---|---|
Field | Type | Description |
CartId | ID | Id of the cart updated. |
Code Sample
The sample below enables you update the end date of a cart after the date of acceptance of the proposal. The auto-roll up end date is the sum of the proposal acceptance start date and selling term. When the recipient of the proposal accepts the quote and updates the status, invoke this API to update the start date and selling term of the products associated to the quote. In the sample below, the user enters the quote name in a search field and clicks Search. If a valid quote exists by the name, the quote is fetched. If the user clicks the update Quote Terms button, the API is invoked and the end date is updated.
public void autoroll()
{
//Search a quote by its name and fetch its ID
List<Apttus_Proposal__Proposal__c> listQuote = [Select Id from Apttus_Proposal__Proposal__c where Name=:quoteNumber LIMIT 1];
//If a valid quote exists with the name execute the if loop
if(listQuote.size() > 0)
{
Apttus_CPQApi.CPQ.UpdateQuoteTermRequestDO updateQTRequest = new Apttus_CPQApi.CPQ.UpdateQuoteTermRequestDO();
updateQTRequest.QuoteId = listQuote[0].Id;
//Start date=current date entered in the from field of the proposal.
updateQTRequest.StartDate = fromdate;
//End date=startdate+selling term
updateQTRequest.EndDate = updateQTRequest.StartDate.addMonths(sellingTerm);
/**updateQTRequest.EndDate = endDate;**/
/*updateQTRequest.SellingTerm = 12;*/
//Execute the API to update quote term
Apttus_CPQApi.CPQ.UpdateQuoteTermResponseDO updateQTReponse = Apttus_CPQApi.CPQWebService.updateQuoteTerm(updateQTRequest);
ID cartID = updateQTReponse.cartID;
//Invoke the finalize cart request to update end date with the cart
Apttus_CPQApi.CPQ.FinalizeCartRequestDO finalizeRequest = new Apttus_CPQApi.CPQ.FinalizeCartRequestDO();
finalizeRequest.CartId = cartId;
//Invoke the finalize cart API to update the cart details
Apttus_CPQApi.CPQ.FinalizeCartResponseDO finalizeResponse = Apttus_CPQApi.CPQWebService.finalizeCart(finalizeRequest);
}
}
The sample below enables you to update the start date and end date of a cart after the date of acceptance of the proposal. When the recipient of the proposal accepts the quote and updates the status, invoke this API to update the start date, end date and selling term of the products associated to the quote. In the sample below, the user enters the quote name in a search field and clicks Search. If a valid quote exists by the name, the quote is fetched. If the user clicks the update Quote Terms button, the API is invoked and the start date is updated. The validity i.e the selling term has to be updated on a pro-rata basis.
public void prorata()
{
//Search a quote by its name and fetch its ID
List<Apttus_Proposal__Proposal__c> listQuote = [Select Id from Apttus_Proposal__Proposal__c where Name=:quoteNumber LIMIT 1];
//If a valid quote exists with the name execute the if loop
if(listQuote.size() > 0)
{
Apttus_Proposal__Proposal__c propSO = [select id, Apttus_Proposal__ExpectedStartDate__c, Apttus_Proposal__ExpectedEndDate__c from Apttus_Proposal__Proposal__c where id = :listQuote[0].Id limit 1];
Date startDate = propSO.Apttus_Proposal__ExpectedStartDate__c;
Date endDate = propSO.Apttus_Proposal__ExpectedEndDate__c;
Apttus_CPQApi.CPQ.UpdateQuoteTermRequestDO updateQTRequest = new Apttus_CPQApi.CPQ.UpdateQuoteTermRequestDO();
updateQTRequest.QuoteId = listQuote[0].Id;
//Fetch the start date of the proposal
updateQTRequest.StartDate = fromdate;
/**updateQTRequest.EndDate = updateQTRequest.StartDate.addMonths(12);**/
//Fetch the end date of the proposal
updateQTRequest.EndDate = endDate ;
updateQTRequest.SellingTerm = null;
//Selling Term to be recalculated based on the start date and end date
updateQTRequest.ReCalcSellingTerm = true;
/*updateQTRequest.SellingTerm = 12;*/
//Execute the API to update quote term
Apttus_CPQApi.CPQ.UpdateQuoteTermResponseDO updateQTReponse = Apttus_CPQApi.CPQWebService.updateQuoteTerm(updateQTRequest);
ID cartID = updateQTReponse.cartID;
//Invoke the finalize cart request to update selling term of product with the cart
Apttus_CPQApi.CPQ.FinalizeCartRequestDO finalizeRequest = new Apttus_CPQApi.CPQ.FinalizeCartRequestDO();
finalizeRequest.CartId = cartId;
Apttus_CPQApi.CPQ.FinalizeCartResponseDO finalizeResponse = Apttus_CPQApi.CPQWebService.finalizeCart(finalizeRequest);
}
}
Integration Details
Use the following information in your integrations with CPQ Web Services API. Refer to Integrating Conga with External Systems for information on how to get started.
API Prerequisites
Response/Request XML
Example Request
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cpq="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQWebService"
xmlns:cpq1="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ">
<soapenv:Header>
<cpq:SessionHeader>
<cpq:sessionId>00DZ000000NAEIA!ASAAQLC3rla0VIl_gk7v0A9K1n7dLEcCAANQHwNfXAPFKZEH292fAdeal5Nps8X2klNu98fcp6usnVFmzKARwE99xq_dE8U6</cpq:sessionId>
</cpq:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<cpq:updateQuoteTerm>
<cpq:request>
<cpq1:EndDate>2020-12-30</cpq1:EndDate>
<cpq1:QuoteId>a0eZ0000005pG5NIAU</cpq1:QuoteId>
<cpq1:QuoteLineItemColl>
<cpq1:LineItems>
<cpq:Apttus_QPConfig__EndDate__c>2020-12-30</cpq:Apttus_QPConfig__EndDate__c>
<cpq:Apttus_QPConfig__SellingTerm__c>1</cpq:Apttus_QPConfig__SellingTerm__c>
<cpq:Apttus_QPConfig__StartDate__c>2020-11-01</cpq:Apttus_QPConfig__StartDate__c>
<cpq:Apttus_QPConfig__DerivedFromId__c>a19Z0000006sPdw</cpq:Apttus_QPConfig__DerivedFromId__c>
</cpq1:LineItems>
</cpq1:QuoteLineItemColl>
<cpq1:ReCalcSellingTerm>false</cpq1:ReCalcSellingTerm>
<cpq1:SellingTerm>1</cpq1:SellingTerm>
<cpq1:StartDate>2020-11-01</cpq1:StartDate>
</cpq:request>
</cpq:updateQuoteTerm>
</soapenv:Body>
</soapenv:Envelope>
Example Response
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQWebService"
xmlns:UpdateQuoteTermResponseDO="http://soap.sforce.com/schemas/class/Apttus_CPQApi/CPQ">
<soapenv:Body>
<updateQuoteTermResponse>
<result>
<UpdateQuoteTermResponseDO:CartId>a1OZ0000002hsIXMAY</UpdateQuoteTermResponseDO:CartId>
</result>
</updateQuoteTermResponse>
</soapenv:Body>
</soapenv:Envelope>