1

We have a scenario that sometimes in CPQ, the ghost quotes which gets created does not automatically gets deleted because the internal CPQ calculation fails. https://help.salesforce.com/articleView?id=000316738&type=1&language=en_US&mode=1

To triggered a recalculation of Quotes we are just doing a dummy updates on such quotes.

List<SBQQ__QuoteLine__c> quoteLines = [SELECT Id,SBQQ__AdditionalDiscountAmount__c FROM SBQQ__QuoteLine__c WHERE SBQQ__Quote__c = 'QuoteId'];

if(!quoteLines.isEmpty()){
    quoteLines.get(0).SBQQ__AdditionalDiscountAmount__c = quoteLines.get(0).SBQQ__AdditionalDiscountAmount__c;
}

update quoteLines;

and the CPQ recalculation gets triggered internally. But how to verify that the recalculation is success, is there a way? Or we just add all Quote Line Items amount and verify if Opportunity Amount matches this.

UDPATE (Just trying with Calculate API but : not working)

When using Calculate API, I am getting this error:

08:07:35.852 (9852147514)|EXCEPTION_THROWN|[438]|System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Product2.SBQQ__PricingGuidance__c

Though the handler gets called successfully, I have no idea how to pass this as I am not using any query to feed Quote. I am using read api to read the Quote using Id.

2 Answers 2

0

You may be able to query SBQQ__RecordJob__c. This is the same object that the QuoteSave Visualforce page uses to display the status to the user. It looks like the SBQQ__RecordId__c field will have the quote id plus the type of job that was run. For example: a1z3m00000NyqQLAAZ::QuoteCalculator.

1
  • This actually did work, but the only catch is the record gets created when you do a dummy update on QuoteLines and not when you use the QuoteCalculator API. Commented May 14, 2021 at 14:55
0

Taking into account the async nature of the calculation you can leverage the existing Quote Calculator API which grants you the ability to attach a callback Apex class that is called after the calculation is finished (instead of forcing a DML), that way you can implement your handling logic after the calculation is finished.

https://developer.salesforce.com/docs/atlas.en-us.cpq_dev_api.meta/cpq_dev_api/cpq_quote_api_calculate_final.htm

1
  • The API never work, its gives 200 as a response, but the recalculation never works. This I have already tried. Commented May 10, 2021 at 8:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .