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 Post

Show Custom And Standard Object

Check Duplicate EmailId when user Insert the Contact

Send Email using Wrapper Classes in Salesforce.