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
anjs2976anjs2976 

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

 

Thanks

 

anjs2976anjs2976

Hello

 

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.

 

thanks

anjs2976

b-Forceb-Force

Hi,

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

https://INSTANCE.salesforce.com/quote/quoteTemplateDataViewer.apexp?id=0Q0900000004H5G&summlid=0EH90000000H7dO

 

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

 

Here is the Javascript executed after clicking on Create PDF button

onclick="null
 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';
pdfOverlay.setSavable(true);
pdfOverlay.setContents('/quote/quoteTemplateDataViewer.apexp?id=0Q0900000004H5G');
pdfOverlay.display();
" 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

 

thanks,

Bala

 

b-Forceb-Force

This is the main Js file for QuotePDf functionality

src="/jslibrary/1280952852000/Quote.js"

 

Thanks,

Bala

anjs2976anjs2976

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.

 

thanks

anjali

b-Forceb-Force

Anjali,

 

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

 

Thanks,

Bala 

 

 

b-Forceb-Force

Anjali,

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\" />';
pdfOverlay.setContents('/servlet/servlet.FileDownload?file=0QD900000004CTm');
pdfOverlay.display();
"

 Again I get it from same source

 

Thanks,

Bala

MultimanMultiman

the parameter summlid is the id of the PDF template

chubsubchubsub

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="https://tapp0.salesforce.com/_ui/core/email/author/EmailAuthor?p2_lkid={!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:column >
   
 <apex:outputLink value="/jslibrary/1280952852000/Quote.js" OnClick="QuotePDFPreview()"> View   </apex:outputLink>   
 
    </apex:column> 
   
   
<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}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

Andy BoettcherAndy Boettcher

*bump*

 

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.

chubsubchubsub

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. 

anil.rao.dravanil.rao.drav

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.