CPQ – QLE – QCP – Update Group Values!

If you’re here you’re eagerly trying to figure out how to update Quote Line Group values in a price rule. Unfortunately, you can’t. Yet. But you can in a QCP! Here’s a basic sample that copies the Quote Account value into the Quote Line Group Account field.

export function onAfterCalculate(quote, lines, conn) {
    quote.groups.forEach(function(group) {
        if (group.record != null) {
            group.record['SBQQ__Account__c'] = quote.record['SBQQ__Account__c'];
    return Promise.resolve();

9 thoughts on “CPQ – QLE – QCP – Update Group Values!

  1. Hi,
    I need to update the guote line group fields header values based on quote line in that particular group.
    for example: i have to update one time total field on the group header.if the charge type of the Quote line is one time the it should sum up the quoteline and update it.

    1. Hi Manusha! Yes you can do this! You would need to loop through your groups, then inside that loop, loop through your lines to gather line values and do some if statement testing of data for your specific criteria. If the criteria hits, set the values in the group!

  2. Hi D P,

    Great stuff.Keep rocking.

    Do you know if QCP gets triggered when a value is updated from a trigger/process ?

  3. Hi

    I have a scenario where i have multiple QLG on a Quote and I would need a way to add product A to all QLG at once. how can we achieve this ?

  4. Hello. Do you have sample code of how to sum Quote Line totals to the Quote Line Group? It is needed and we have been using DLRS to calculate however it doesn’t work the first time b/c of the order of operations.

    SCENARIO: I have multiple lines under a quote line group and need to sum the One Time Fees and Revenue as separate items. Each group could have different lines and amounts so the group should only sum the quote line items underneath it.

    1. Yes you can definitely do this but I don’t have sample code. I’ve done this sort of thing before. This might have to be a next article!

      1. Hello, I have a similar requirement. I have Admin Fee product in each quote line group. I have to calculate admin fee price based on % of net totals of other quote lines in that quote line group. I have written the logic in QCP. But it needs ‘Quick Save’ and then have click ‘Calculate’ to get correct pricing.

        is there anything that i am missing? Or should this be done on apex trigger as Quote line group lookup on quote line is available later in the calculation stage?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.