You need to sign in to do that
Don't have an account?
Evannn
Too many nested getContent calls when trying to attach a Visualforce page as a PDF
Hi all,
I am new to Apex programming and am getting weird little error when i try to attach a PDF to Notes and Attachments. I'm rendering a Visualforce page as a PDF, with an extension to an "EstimateProposal" Apex class. The project compiles fine, but when I run it in the UI, I get an error "EXCEPTION_THROWN|[70,24]|System.VisualforceException: Too many nested getContent calls." Funny thing is, the code block works when I execute it anonymously, just not it's part of my VF controller execution flow. Anyone seen this before or could point me to a resource to fix it? Any help would be greatly appreciated!
****APEX CLASS****
public PageReference attachQuote() {
PageReference pdfPage = Page.GenerateProposal;
pdfPage.getParameters().put('id',this.opp.Id);
Blob pdfBlob = pdfPage.getContent();
Attachment proposalPDF = new Attachment (parentId = this.opp.Id, name=this.opp.name + '.pdf', body = pdfBlob);
insert proposalPDF;
return null;
}
}
****VISUAL FORCE PAGE****
<apex:page standardController="Opportunity" extensions="EstimateProposal" renderAs="pdf" showHeader="false" sidebar="false" >
Hi Evann, have you resolved the issue? I have the same problem , tried several things modifying the code - nothing works. Any thougths would be greatly appreciated.
no one is availabe to solve this issue Also no one from salesforce guy know why this error is coming...........
Hi,
I would like to open this and see if there is any possible solution, because I have the same issue when saving a PDF that has been created. The VF page to create the PDF is in place (it was before me) and this is the controller that creates the PDF:
I'm trying to save a PDF when its created (an invoice), in order to that I placed this code in the controller constructor:
But I get the error "Too many nested getContent " when the new window that should show the PDF opens.
Has anyone faced this problem before?
Any help is very welcome.
Thanks,
MGA