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
kardoluskardolus 

Additional Quote Attachment

Hi, 

 

I'd like to (automatically) attach an extra document to the Quotes in SalesForce. I was first thinking about overriding the Email Quote button with a link. But unfortunately it seems like you can only add one document to your quote using the &doc_id attribute. Was also thinking about making my own VisualForce page, can create all those Task fields the standard button makes, but which pagereference is actually linked to the Task called 'Send an Email'? You get to that page when clicking 'Email Quote'. 

 

Already overriden the 'New Quote' and 'Create PDF' buttons with VisualForce + Apex. I first had the idea that I would add an extra attachment to the Quote object. But when you click 'Email Quote', that attachment doesn't show up. 

 

The attachment was created using the standard Attachment Apex class.

 

Any ideas would be welcome.

 

Best Answer chosen by Admin (Salesforce Developers) 
kardoluskardolus

Discovered this can be done by attaching the additional file to an email template. Then you can overwrite the 'Email Quote' button with your own VisualForce page. To get the quote Id you can use the return URL value like this:

 

ApexPages.currentPage().getParameters().get('retURL')

 

Next you define a page reference in your apex class pointing to the original page, but with the addition of &template_id=<your template ID>&new_template=1