Posts

Showing posts from January 2, 2017

Send Quote Pdf to Contact Person and Save the Quote PDF in attachement

Requirement: Need to create the save and send Quote Pdf custom button on Quote detail page and when user click on this button quote pdf as attachment send to quote contact person and pdf attached in attachment under quote Solution: 1) Need to create web service class  2 ) Create a custom button as a Detail page button and  Behavior as Execute Java Script and content source is as onClick Java Script and call the web service class. WebServiceClass Name: global class clsSaveQuotePDFInAttachmentUnderQuote {      webservice static String AttachPDFToQuote(string Id){                string strResponse = '';         try         {             PageReference pageRef = new PageReference('/apex/VFPageName?Id='+Id);                          Blob content;             if(!Test.isRunningTest())                 content = pageRef.getContent();             else                 content = Blob.valueOf( EncodingUtil.urlEncode('abc', 'UTF-8'));        

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