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

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

Save DOM Element As Image Attachment In Salesforce

Use a dom-to-image Javascript library that can turn arbitrary DOM nodes into a vector (SVG) or raster (PNG or JPEG) image in Salesforce.

April 8, 2021

3 Min Read

For Developers

Embed Image In Conga Document Using Salesforce ID

Learn how you can embed an image uploaded as a Salesforce Attachment in a Conga Document. Use the Conga IMAGE tag you can embed images.

February 25, 2021

4 Min Read