For Developers

CPQ Custom Quote Lines

2 min read
CloudAnswers photo
CloudAnswers
Share
TODO

Who is this for:  Salesforce CPQ developers and admins

What's in it for me:  Learn to inspect the PDF generation process and see how to make unconventional changes

Background:  Custom quote lines must be coded from scratch in CPQ, but if you want to do something simple like hide the group total?  We had one customer who uses optional groups as an alternative for the current quote, allowing them to present a PDF with a 1 year option and a 3 year option to highlight savings.

Step 1:  Open the developer console so you can watch what happens when the PDF is generated

Step 2:  Preview a quote that has a custom document with the quote lines content.

Step 3:  Check out the logs in developer console to see all the pages that were loaded:

The one I was looking for was "sbqq__lineitemscontent".  For the unindoctrinated, the name is in the format "namespace__filename" (two underscores between them).  Since pages are not protected in a managed package, you are actually free to view the source and copy it for your own needs.  Just go to Setup > Pages and find the page "lineitemscontent" and you can see the markup.  Here it is for your convenience:

<apex:page language="{!vfLanguage}" controller="SBQQ.DocumentGeneratorController" contentType="application/xml" showHeader="false" sidebar="false">
    <apex:outputPanel layout="none" rendered="{!hasQuote}">
        <c:lineItemGroups quote2="{!quote2}" template="{!template}"
            staticGroups="{!staticGroups}" dynamicGroups="{!dynamicGroups}"
            currencyFormatPattern="{!currencyFormatPattern}"
            fontSize="{!fontSize}" fontFamily="{!fontFamily}" textColor="{!textColor}" tableStyle="{!tableStyle}"/>
        <c:quoteTotals quote2="{!quote2}" template="{!template}"
            staticGroups="{!staticGroups}" dynamicGroups="{!dynamicGroups}"
            currencyFormatPattern="{!currencyFormatPattern}"
            fontSize="{!fontSize}" fontFamily="{!fontFamily}" textColor="{!textColor}"/>
    </apex:outputPanel>
</apex:page>

Because the components used in this page are in global (lineItemGroups and quoteTotals) we can copy this page and refer to them in our own namespace.  The only catch: you need to switch the namespace from "c:" to "sbqq:" since you moved the page to your own namespace.

Here is what it looks like after the replace:

<apex:page language="{!vfLanguage}" controller="SBQQ.DocumentGeneratorController" contentType="application/xml" showHeader="false" sidebar="false">
    <apex:outputPanel layout="none" rendered="{!hasQuote}">
        <**sbqq**:lineItemGroups quote2="{!quote2}" template="{!template}"
            staticGroups="{!staticGroups}" dynamicGroups="{!dynamicGroups}"
            currencyFormatPattern="{!currencyFormatPattern}"
            fontSize="{!fontSize}" fontFamily="{!fontFamily}" textColor="{!textColor}" tableStyle="{!tableStyle}"/>
        <**sbqq**:quoteTotals quote2="{!quote2}" template="{!template}"
            staticGroups="{!staticGroups}" dynamicGroups="{!dynamicGroups}"
            currencyFormatPattern="{!currencyFormatPattern}"
            fontSize="{!fontSize}" fontFamily="{!fontFamily}" textColor="{!textColor}"/>
    </apex:outputPanel>
</apex:page>

In our version, we commented out the tag sbqq:quoteTotals since it was showing even if the switch for it in quote template was turned off (bug or not, project has to go live, right?).

Hope this helps you in your CPQ journey and let us know if you need any CPQ/StellBrick help.


CloudAnswers photo
CloudAnswers
Share

About CloudAnswers

Salesforce apps, powerful components, custom development, and consulting. Our experienced team helps you to create and modify workflow processes in salesforce.

Related Articles

For Developers

Designing User Security and Visibility in Salesforce

Trust and security are at the top of Salesforce's priority list. The platform has everything you need if you're looking to construct a robust user security paradigm. However, this security approach has flaws that an attacker can exploit to gain access to your data. The Salesforce Architect has the duty to ensure that these features are set up correctly.

March 16, 2022

7 Min Read

For Developers

Batch Apex Error Event - CloudAnswers Hackathon

A hackathon is an event usually put together by a tech organization. The event brings programmers together over a specific period to collaborate on a project.

June 28, 2021

5 Min Read

For Developers

Deploy a Hasura GraphQL API for Salesforce in minutes

Salesforce API limits can stop you from using Salesforce data. Get around that, by using open-source Hasura GraphQL API for Salesforce.

January 12, 2021

3 Min Read