Open Pdf On Quote Object using custom button as like standard Create pdf button


Requirement: Create a custom button on Quote detail page and open a vf page in pdf form same a Create pdf standard button functionality

Solution: Create a custom button as a Detail page button and  Behavior as Execute Java Script and content source is onClick Java Script

Paste the code as mention below

{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")} 

var pdfOverlay = QuotePDFPreview.quotePDFObjs['quotePDFOverlay']; 
pdfOverlay.dialog.buttonContents = '<input value=\"Cancel\" class=\"btn\" name=\"cancel\" onclick=\"QuotePDFPreview.getQuotePDFObject(\'quotePDFOverlay\').close();\" title=\"Cancelar\" type=\"button\" />'; 

pdfOverlay.setSavable(true); 
pdfOverlay.setPDFContents('/apex/VFPageName?id={!Quote.Id}',null,null); 
pdfOverlay.display();

Note: Change the VFpageName with your original VF Page name


                             Thanks,
                         Sumit Shukla







Comments

Popular posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page