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
Am123Am123 

How to save: Quote using VF page

Hi,

 

We have created our own Quote PDF using a VF page. We cannot however find a way to save this PDF in the Quote PDF related list as we can had we been using the standard quote functioinalityy provided by salesforce in which case the PDF opens up in a sepearte window and the interface has the  'save to quote button'.

 

As the saved quote gets saved as a record of QuoteDocument object. Can we perform a DML opeation in the QuoteDocument object?

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Yes, you can create QuoteDocuments from Apex code.  Below is an example of creating a QuoteDocument from a custom visualforce page:

 

            PageReference pr=Page.MyQuotePage;
            pr.getParameters().put('id', quote.id);
       	    Blob content=pr.getContent();
            QuoteDocument doc=new QuoteDocument(Document=content,
                                                QuoteId=quote.id);
            insert doc;