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
Michael YoccaMichael Yocca 

Clone Quote PDF and attach to parent opportunity

Hi,

I have a working trigger on Quote for when the status is changed to 'Accepted' it calls a helper class to clone associated attachments and set the parent Id to the Opportunity that the quote lookups to. It works, problem is I was targeting the quote pdf that is generated from the build in "Create PDF" button" and shows up in the Notes & Attachments related list as well as the Quote PDFs related list. 

Does anyone know the object reference I am looking for? I realize the same result could be done by utilizing visualforce however the purpose of this trigger is to replicate a "Send with Docusign" javascript button that pulls related quote attachments into the envelope in classic experience, to lightning experience. 
Best Answer chosen by Michael Yocca
Michael YoccaMichael Yocca
I figure it out. It's called QuoteDocument. For every Quote Document a quote has attached it creates an equivalent attachment pdf and attaches to the parent opportunity. 

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_quotedocument.htm

All Answers

Michael YoccaMichael Yocca
For further clarification it cloned an attachment I uploaded and attached it to the opportunity but not the generated quote pdf file. 
Michael YoccaMichael Yocca
I figure it out. It's called QuoteDocument. For every Quote Document a quote has attached it creates an equivalent attachment pdf and attaches to the parent opportunity. 

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_quotedocument.htm
This was selected as the best answer