function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Agustín MedinaAgustín Medina 

CPQ Rich text field with apex variables.

I'm trying to use CPQ objects calling to Template Content in order to render it in a custom PDF but when I'm trying to display the SBQQ__RawMarkup__c field, the variables of quote record are displayed as plain text ( {!object.field} ), not the value of the record.

How can I reuse the CPQ template content?
Is it possible to escape the field except the apex variables in the visualforce {!variable}?

Heres my code and some pics.

Visualforce
<apex:page controller="PDFTestCtrl" showHeader="false" sidebar="false" standardStylesheets="false" renderAs="PDF" >
    {!quote.Name}
    <br/>
    {!templateSections.SBQQ__Content__r.Name} 
    <br/>
    <apex:outputtext value="{!templateSections.SBQQ__Content__r.SBQQ__RawMarkup__c}" escape="false"/>
</apex:page>

Controller
public class PDFTestCtrl {

    public SBQQ__Quote__c quote {get; set;}
    public SBQQ__TemplateSection__c templateSections {get; set;}
    
    Id quoteId;

    public PDFTestCtrl () {
        //'qid' is sent by CPQ Quote Template
        quoteId = (Id) ApexPages.currentPage().getParameters().get('id');
        
        // Quote
        quote = [SELECT Id, Name,  SBQQ__QuoteTemplateId__c FROM SBQQ__Quote__c WHERE id =: quoteId];

        templateSections = [SELECT Id, Name, SBQQ__Content__c, SBQQ__Content__r.Name, SBQQ__Content__r.SBQQ__RawMarkup__c FROM SBQQ__TemplateSection__c WHERE SBQQ__Template__c =: quote.SBQQ__QuoteTemplateId__c AND Name = 'Heading'];
        
    }

}
Template record
Template object with apex references
PDF
PDF with the plain text variables
Greetings!
SwethaSwetha (Salesforce Developers) 
HI Agustín,

You can reach out to Salesforce Revenue Cloud page on https://trailblazers.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F93A0000009TGxSAM for better visibility and inputs on your ask.
 
If this information helps, please mark the answer as best. Thank you