1

Within CPQ, Opportunity Line Items should automatically sync with the Primary Quote's Line Items. However, when re-parenting a primary quote from a Source Opp to a Destination Opp (Destination Opp initially has no quotes), then the Destination Opp's line items do not get automatically populated upon re-parenting. Only after the user goes into the Quote Line Editor and selects Save does the Opp Line Items get synced to the Quote Line Items.

Anyone else experience this? Is there any coding work around to force the Opp Line Items to sync up to the Quote's Line Items upon re-parenting a Quote?

Thanks, Mike

  • are you reparenting through the CPQ UI? or via some custom apex or lightning Flow? – cropredy Nov 23 '19 at 21:40
  • @cropredy I am reparenting through the CPQ UI. – Mike Paisner Nov 25 '19 at 15:52
0

It seems the only way I was able to address this issue is within the afterUpdate portion of the SBQQ__Quote__c trigger. I look if the quote's SBQQ__Opportunity2__c field has changed. If it has changed, then I query all the line items of the quote and perform an update on the quote line items. This seems to force the quote line items to sync to the Opp line items.

    Set<Id> setQuoteIds = new Set<Id>();
    for(SBQQ__Quote__c newQuote : newList) // Loop through newList: all quotes in afterUpdate portion of trigger
    {
        if (newQuote.SBQQ__Opportunity2__c != oldMap.get(newQuote.Id).SBQQ__Opportunity2__c)  // oldMap is map of old versions of quotes
        {
            setQuoteIds.add(newQuote.Id);
        }
    }

    if (!setQuoteIds.isEmpty())
    {
        List<SBQQ__QuoteLine__c> listQuoteLines = [SELECT ID FROM SBQQ__QuoteLine__c WHERE SBQQ__Quote__c IN: setQuoteIds];
        if (!listQuoteLines.isEmpty()) update(listQuoteLines);  // This causes sync of quote line items to Opp line items.
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.