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

Override Create PDF button to show a popup on Quote Detail Page

Hello ,


I have an approval process on Quote that locks the Quote record. While the record is locked/not approved, we want to restrict user to perform actions on Quote like Create PDF via Create PDF button on quote detail page.


On looking at Create PDF page, looks like it is making a function call and the URL of the page is not accessible to us which we could have used in custom vfp page and redirected to standard page reference if the record is approved else

show a popup.


Is it possible? I have researched quite a bit but did not find any clue. Its a critical requirement for us hence in case anybody has any idea please let me know







This is an important requirement for us. In case anybody has an idea on this and knows how we can override create pdf button on quote detail page and then in the custom apex class redirect to the standard create pdf popup on some condition.






It is redirecting to sum page when we click on the page

with QuoteId and Summid as two parameter

final pdf URL looks like as follw  and it is accessible


I didnt find any detail about Summlid parameter , id is Quote id


Here is the Javascript executed after clicking on Create PDF button

 var pdfOverlay = QuotePDFPreview.quotePDFObjs['quotePDFOverlay'];pdfOverlay.dialog.buttonContents = '<input value=\"Save to Quote\"  class=\"btn\" name=\"save\" onclick=\"QuotePDFPreview.getQuotePDFObject(\'quotePDFOverlay\').savePDF(\'0\',\'0\');\" title=\"Save to Quote\" type=\"button\" /><input value=\"Save and Email Quote\"  class=\"btn\" name=\"saveAndEmail\" onclick=\"QuotePDFPreview.getQuotePDFObject(\'quotePDFOverlay\').savePDF(\'1\');\" title=\"Save and Email Quote\" type=\"button\" /><input value=\"Cancel\"  class=\"btn\" name=\"cancel\" onclick=\"QuotePDFPreview.getQuotePDFObject(\'quotePDFOverlay\').close();\" title=\"Cancel\" type=\"button\" />';
pdfOverlay.summlid = '0EH90000000H7dO';
" type="button" />



Basically this is some modal dioloug box with some parameter provided,


I am planning to embed this script in  some S-control and hitting  S-Control in place of  create Pdf


hope this will help you






This is the main Js file for QuotePDf functionality






Thanks Bala. Yeah even I could not get summlid param earlier.

The pdf is rendered but how to get the exact same popup with the buttons Save to Quote, Save and Email Quote etc .


The requitement is that if some condition fails then we need to give a popup saying that Create PDF is not possible, if condition satisifies then display the standard create pdf page.







I am trying to add entire script in S-Control and trying to call it on Button Click,

Because this is  the only solution that I can see.

Could you please do some POC on that, I am plannig to work on this topic on weekend








This is the script code to show buttons on Popup

 var pdfOverlay = QuotePDFPreview.quotePDFObjs['quotePDFOverlay2'];pdfOverlay.dialog.buttonContents = '<input value=\"Email Quote\"  class=\"btn\" name=\"emailQuote\" onclick=\"javascript:navigateToUrl(\'/_ui/core/email/author/EmailAuthor?p2_lkid=00190000003iCaY&rtype=003&p3_lkid=0Q0900000004H5G&doc_id=0QD900000004CTm&retURL=%2F0Q0900000004H5G\',\'RELATED_LIST\');\" title=\"Email Quote\" type=\"button\" /><input value=\" Close \"  class=\"btn\" name=\"close\" onclick=\"QuotePDFPreview.quotePDFObjs[\'quotePDFOverlay2\'].close();\" title=\"Close\" type=\"button\" />';

 Again I get it from same source





the parameter summlid is the id of the PDF template


So how did this go? I'm trying to replicate the View PDF button using the jslibrary/1280952852000/Quote.js Below the code i have so far, but it's not workIng.  Any suggestions?


I'm basically trying to replicate the Quote PDFs related list on the Quote, but remove the delete button.  I'm just stuck at the preview functionality:


<apex:page standardController="Quote" showHeader="false" sidebar="fasle">
<apex:includeScript value="/jslibrary/1280952852000/Quote.js"/>

<apex:form >
<apex:pageBlock title="Quote PDFs" >
<apex:pageBlockTable value="{!Quote.QuoteDocuments}" var="oli">
    <apex:column headerValue="Action">
<b><apex:outputLink value="{!oli.Quote.Opportunity.Account.Id}&rtype=003&p3_lkid={!oli.Quote.Id}&doc_id={!oli.Id}&retURL=%2F{!oli.Quote.Id}" target="_blank">Email</apex:outputLink></b>

    <apex:column >
 <apex:outputLink value="/jslibrary/1280952852000/Quote.js" OnClick="QuotePDFPreview()"> View   </apex:outputLink>   
<apex:column value="{!oli.Name}"/> 
<apex:column value="{!oli.Discount}"/>
<apex:column value="{!oli.GrandTotal}"/>
<apex:column value="{!oli.CreatedBy.Name}"/>
<apex:column value="{!oli.CreatedDate}"/>


Andy BoettcherAndy Boettcher



Did you end up finding a solution to this?  I'm hot on the heels of decoding all of the JS behind this magical button, but am stuck at a generic XML / HTTP response from SF:


{"quotePDFSaveError":"Error saving PDF to quote.  Please try again."}

Quite frustrating.  Let me know if you figured it out - or if not, maybe we can share notes.


The only solution I found was to bring the PDF view in another window, I was not able to replicate the PDF Overlay.  I was able to create an acceptable solution to mimic the QuotePDF's related list, but without the delete button. 


I know this post is year old, however I was wondering how you were able to replicate the Quote PDFs related list to store Documents on a custom object. Thanks for your time, and hope to hear from you.