+ Start a Discussion
Nidish G 6Nidish G 6 

Flow creates quote templates while debugging, but does not create while actually running through actual live journey

We have a flow which creates Quote templates when we click a custom button called "Generate PDF". I am able to create a template when I try to debug the flow. But when I hit the GeneratePDF button it creates a blank PDF instead of PDF based on templates.

The below is my apex class which accepts two input parameters from the flow:
1. Quote ID
2. Template ID

public class generateQuotePdfDocument_2{

@InvocableMethod(label='Invoke Apex')
    public static void invokeThisMethod(List<FlowInputs> request) {
    //input details that comes to apex from flow
    public class FlowInputs{
        public String qID;
        public String QuoteTemplateID;

public static void createQuoteFutureMethod (List<FlowInputs> request) {
//Id of Quote record.
String QuoteID = request[0].qID;
//String QuoteID = '0Q0020000008VfGCAU';
//Id of quote Template
String templateID = request[0].QuoteTemplateID;
//String templateID = '0EH0M000000sssO';

system.debug('This is request object: '+request);
system.debug('This is request[0] object: '+request[0]);
//This Url create the pdf for quote
String quoteUrl = '/quote/quoteTemplateDataViewer.apexp?id=';
quoteUrl +=QuoteID;
quoteUrl +='&headerHeight=190&footerHeight=188&summlid=';
quoteUrl +=templateID ;
quoteUrl +='#toolbar=1&navpanes=0&zoom=90';
system.debug('This is quoteURL object: '+quoteUrl);
//Create pdf content
PageReference pg = new PageReference(quoteUrl) ;
//Document object of quote which hold the quote pdf
QuoteDocument quotedoc = new QuoteDocument(); 
//Get the content of Pdf.
Blob b = pg.getContentAsPDF() ;
//content assign to document
quotedoc.Document = b;
//assign quote id where pdf should attach
quotedoc.QuoteId = QuoteID ;
//insert the quotdoc
 insert quotedoc; 
ShirishaShirisha (Salesforce Developers) 
Hi Nidish,


Have you tried to analyzed the code execution while debugging the flow by clicking on the button.Please enable the debug logs while debugging the flow and by executing the process to compare the logs.


Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Mat TzetzosMat Tzetzos
Hi Nidish,

Were you ever able to solve this problem? I'm experiencing the exact same thing. I compared debug logs per Shirisha's recommendation and found they were identical save 1 line:

10:27:17:556 VARIABLE_ASSIGNMENT [53]|b|BLOB(789 bytes)

10:31:22:060 VARIABLE_ASSIGNMENT [53]|b|BLOB(89613 bytes)

The 2nd being the successful one. So it's obviously processing more data during the Flow Debug vs. the Lightning Action calling the flow. I've configured the flow which has a screen component for the user to select the Flow template which then assigns the template variable I'm passing into the Apex Class. The rest of the flow works perfectly so I can't concieve any reason why the PDF turns up blank in the live run.