--- name: cpq-quote-templates description: "Use when designing or troubleshooting Salesforce CPQ (SBQQ) quote templates: building template sections, configuring line columns, conditionally showing sections, generating branded PDFs, or handling multi-language output. Triggers: 'CPQ quote template', 'SBQQ template', 'CPQ PDF', 'line columns', 'quote template sections', 'conditional section', 'CPQ quote document'. NOT for standard Salesforce quote templates (Setup > Quote Templates), Visualforce-only PDF customization, or CPQ pricing rules and price books." category: admin salesforce-version: "Spring '25+" well-architected-pillars: - Reliability - User Experience - Operational Excellence triggers: - "how do I add line item columns to a CPQ quote template PDF" - "CPQ quote template section is not showing up conditionally on the PDF" - "how do I build a branded PDF output for Salesforce CPQ quotes with a logo and custom sections" - "CPQ quote PDF shows blank line items table even though quote has products" - "how do I support multiple languages in CPQ quote documents" - "what is the difference between HTML, Line Items, and Quote Terms content types in CPQ templates" tags: - cpq - cpq-quote-templates - sbqq - pdf-generation - line-columns - conditional-sections - quote-documents inputs: - "Whether Salesforce CPQ (managed package SBQQ) is installed and licensed" - "Existing SBQQ__QuoteTemplate__c records and their current section/content structure" - "Which SBQQ__QuoteLine__c fields need to appear in the line items table" - "Any conditional visibility requirements (which sections should print under what circumstances)" - "Branding requirements: logo dimensions, fonts, color palette" - "Multi-language or multi-locale requirements" outputs: - "Configured SBQQ__QuoteTemplate__c with sections and content records" - "SBQQ__LineColumn__c records defining the line items table columns" - "Conditional visibility field configuration on SBQQ__TemplateSection__c" - "PDF generation guidance and known CSS limitations" - "Multi-language template strategy" dependencies: [] version: 1.0.0 author: Pranav Nagrecha updated: 2026-04-28 --- # CPQ Quote Templates Use this skill when a practitioner needs to design, configure, or troubleshoot Salesforce CPQ (SBQQ) quote templates: building the section and content hierarchy, defining which quote line fields appear in the line items table, controlling conditional section visibility, producing branded PDF output, or supporting multiple languages. This skill does NOT cover standard Salesforce quote templates configured in Setup > Quote Templates — those use `QuoteLineItem` and are covered by the `admin/quotes-and-quote-templates` skill. --- ## Before Starting Gather this context before working on anything in this domain: - **CPQ managed package must be installed**: All CPQ template objects (`SBQQ__QuoteTemplate__c`, `SBQQ__TemplateSection__c`, `SBQQ__TemplateContent__c`, `SBQQ__LineColumn__c`) exist only when the SBQQ managed package is installed. Confirm the package is present before any configuration. - **Standard quote templates do not work for CPQ**: The most common mistake is directing practitioners to Setup > Quote Templates. Standard templates query `QuoteLineItem`; CPQ lines live in `SBQQ__QuoteLine__c`. The result is a PDF with an empty line items table every time. - **HTML in CPQ templates is converted to XSL-FO**: CPQ's PDF engine converts HTML content to XSL-FO before rendering. CSS class-based styling, flexbox, CSS grid, and many positioning properties are silently ignored. All styling must use inline styles on every element. - **Image size limit is 5 MB per image**: Images embedded in template HTML or stored as Salesforce Files referenced in templates must be under 5 MB. Larger images cause PDF generation to fail silently or time out. - **Multi-language requires separate templates per locale**: CPQ has no native translation layer for quote templates. Each language requires a separate `SBQQ__QuoteTemplate__c` record. Template selection logic must be implemented in a Flow or Process Builder that sets the template lookup field on the quote based on the quote's locale or account language. --- ## Core Concepts ### Template Object Hierarchy CPQ quote templates are structured across three related objects: ``` SBQQ__QuoteTemplate__c (the top-level template record) └── SBQQ__TemplateSection__c (ordered sections: Header, Cover Page, Body, Footer) └── SBQQ__TemplateContent__c (content blocks within each section) ``` **SBQQ__QuoteTemplate__c** is the entry point. A quote record has a lookup to a template; when a user clicks "Preview" or generates the document, CPQ walks this hierarchy to build the PDF. **SBQQ__TemplateSection__c** defines a printable region. Each section has a `SBQQ__Type__c` field that controls its role: | Section type | Role | |---|---| | Header | Appears at the top of every page | | Cover Page | Full first-page section, printed before body content | | Body | The main content area; Body sections marked as "Line Items" repeat for each group of quote lines | | Footer | Appears at the bottom of every page | Sections have an `SBQQ__Orientation__c` field (Portrait / Landscape) and an `SBQQ__PageBreakBefore__c` checkbox to force page breaks between sections. **SBQQ__TemplateContent__c** is the leaf node. Each content record belongs to one section and has a `SBQQ__Type__c` that determines what it renders: | Content type | What it renders | |---|---| | HTML | Rich-text / custom HTML rendered inline; supports company logo, custom messaging, fields merged using `{!Quote.FieldName}` merge syntax | | Line Items | Renders a table of `SBQQ__QuoteLine__c` records; column definitions come from `SBQQ__LineColumn__c` records | | Quote Terms | Renders the master Terms and Conditions text stored on the template | | Custom | References a Visualforce page by name; the page must use `renderAs="pdf"` and accept the quote ID as a parameter | ### Line Columns (SBQQ__LineColumn__c) Line columns define which fields from `SBQQ__QuoteLine__c` appear in the Line Items content type table. Each `SBQQ__LineColumn__c` record specifies: - `SBQQ__FieldName__c` — the API name of the field on `SBQQ__QuoteLine__c` (standard, custom, or formula) - `SBQQ__Heading__c` — the column header text printed in the PDF - `SBQQ__DisplayWidth__c` — percentage of the table width this column occupies (all columns should sum to 100) - `SBQQ__Alignment__c` — Left, Center, Right - `SBQQ__FormatType__c` — controls number/currency/percent formatting Custom fields added to `SBQQ__QuoteLine__c` are fully supported. Formula fields that reference parent `SBQQ__Quote__c` fields are also supported, but complex multi-hop formulas can slow PDF rendering. ### Conditional Visibility Each `SBQQ__TemplateSection__c` has a `SBQQ__ConditionalPrintField__c` field that accepts the API name of a field on `SBQQ__Quote__c`. The section is shown only when that field evaluates to "truthy" by these exact rules: | Field type | Condition to show the section | |---|---| | Checkbox | Field value = `true` | | Text | Field value = the exact string `"true"` (case-sensitive) | | Number / Currency / Percent | Field value != `0` and is not null | If `SBQQ__ConditionalPrintField__c` is blank, the section always prints. This mechanism is declarative-only — no Apex or formula is evaluated at PDF time beyond the single field lookup. --- ## Common Patterns ### Pattern 1: Branded Cover Page with Company Logo **When to use:** The org requires a professional first page with the company logo, rep name, account name, and quote expiry date before the line items table. **How it works:** 1. Create a `SBQQ__TemplateSection__c` with `SBQQ__Type__c = Cover Page` and `SBQQ__PageBreakBefore__c = false`. 2. Create a `SBQQ__TemplateContent__c` child with `SBQQ__Type__c = HTML`. 3. In the HTML content block, reference the logo as a base64-encoded inline `` tag or as a Salesforce Files URL. Keep the file under 5 MB. 4. Use CPQ merge fields (`{!Quote.SBQQ__Account__r.Name}`, `{!Quote.SBQQ__ExpirationDate__c}`) directly in the HTML body. 5. Use only inline CSS (`style="..."`) — no `