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
Behzad Bahadori 18Behzad Bahadori 18 

Custom button in Quote needs to use the Custom PDF

Hi , I have created Custom pdf with a wizard that we use , but now I need to create custom button inside Quote which gets the Quoteline Item , or the Quote ID and pas it to my PDF, I dont knwo how I can make button that will get atleast Quote ID . if I get the Quote ID I might be able to to just pass that to my PDF Apex and create new one
Shikha AgashiShikha Agashi
In Custom button, use URL to pass record ID to PDF page anfd then you can use this ID in apex controller that is referred on PDF page through get parameter method.
 
Behzad Bahadori 18Behzad Bahadori 18
Yes i did that and I thought if I pass the Id of the new quote the new line items would carry over too, but it didnt :( how can I clone the Quote
Shikha AgashiShikha Agashi
Your custom button URL should be calling Apex page:

/apex/PDFVFPageName?id={!Quote.Id}.


In controller, 
 
public Id QuoteId{get;set;}
Id=apexpages.currentpage().getparameters().get('id'); // Write this code in constructor
Please try this and let me know if this works. If not, please paste your URL link as well as Controller code
Behzad Bahadori 18Behzad Bahadori 18
hey, The URL is working fine I get the URL but still is generating the old Quote for me. even when I am passing the Quote ID it needs to create a new Quote with that URL
Shikha AgashiShikha Agashi
Can you please paste your controller code here?
 
Behzad Bahadori 18Behzad Bahadori 18
Its very complex, and I am doing multiple different things, in multiple different controller. 
Behzad Bahadori 18Behzad Bahadori 18
how can i make this work 
ApexPages.currentPage().getParameters().get('mId').getContentAsPDF();
Shikha AgashiShikha Agashi
I am not sure about above scenario. But are you updating soql query to point towards QouteID from below variable? If you are getting ID in URL and then controller, you just need to fetch your query related to that ID only, so there would not be old Qoute.