0

I just created a simple quote template. With 1 Template Section. I have assigned that section with a Custom Template content that references a visualforce page I created.

Visualforce page,

<apex:page contentType="text/xml" controller="CustomQuoteController" showHeader="false">
    <apex:outputText value="{!Quote.SBQQ__BillingName__c}"></apex:outputText>
</apex:page>

CustomQuoteController,

public class CustomQuoteController{

       private final SBQQ__Quote__c currentQuote;
       private SBQQ__QuoteLine__c[] currentQuoteLineList;

       public CustomQuoteController(){
            SBQQ__Quote__c[] currentQuoteList = [SELECT Id, SBQQ__BillingName__c 
            FROM SBQQ__Quote__c WHERE Id = :ApexPages.currentPage().getParameters().get('id')];

            if(currentQuoteList.size() > 0){
                 currentQuote = currentQuoteList[0]; 
            }
       }

       public SBQQ__Quote__c  getQuote(){
             return currentQuote;
       }


       public SBQQ__QuoteLine__c[] getQuoteLines(){

               if(currentQuote != null){
                     currentQuoteLineList = [SELECT id, SBQQ__ProductCode__c 
                     FROM SBQQ__QuoteLine__c WHERE SBQQ__Quote__r.id = :currentQuote.id];
               }

               return currentQuoteLineList;
       }
}

SBQQ__BillingName__c name doesn't display when preview quote template document. It's just blank. Anyone know why ? What am I missing ? Do I have to change something ?

When I remove contentType="text/xml" and preview the visualforce page it shows the SBQQ__BillingName__c value.

This all also in Salesforce CPQ.

How to make it work and show up in quote document ?

1
2

I figured it out, via debugging, a couple of months back regarding this issue. For Salesforce CPQ Quote Template, ApexPages.currentPage().getParameters() doesn't have a 'id' parameter. It has a 'qid' parameter.

So this,

SBQQ__Quote__c[] currentQuoteList = [SELECT Id, SBQQ__BillingName__c 
            FROM SBQQ__Quote__c WHERE Id = :ApexPages.currentPage().getParameters().get('id')];

needs to be changed to,

SBQQ__Quote__c[] currentQuoteList = [SELECT Id, SBQQ__BillingName__c 
            FROM SBQQ__Quote__c WHERE Id = :ApexPages.currentPage().getParameters().get('qid')];

Here are parameters returned by ApexPages.currentPage().getParameters() for Salesforce CPQ Quote Templates,

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.