You need to sign in to do that
Don't have an account?
RageReference.getContent() failing on Spring '10 release
I have some apex code that has been running since winter '09 and it still works in Winter '10. It consistently fails in Spring '10
The apex code that invokes a visualforce page and then invokes a getContent method to retrieve the PDF that is created by the Visualforce page. It consistently fails in Spring '10 with the following error
System.VisualforceException: core.apexpages.exceptions.ApexPagesGenericException:
Has anyone seen this and have you figured out what to do? Here is a code snippet - it fails on the getContent. I have not heard of any changes that are in Spring '10 that should cause this to fail.
PageReference pdfPage = new PageReference(Page.MyPage.getURL() + '?id=' + quoteId); System.debug('URL for attachment ' + pdfPage.getURL()); System.debug('create new attachment'); //create an attachment //Attach as an Attachment Attachment attachment = new Attachment(); attachment.ParentId = quoteId; attachment.name = 'QuoteSent' + System.now()+'.' + extension; attachment.body = pdfPage.getContent();
Like I have a problem, but I just created the code apex, which also uses the getContent method to retrieve a PDF file.
I debug and all I could find are these errors I hope you can help solve the case:
20100208225023.103:Class.ClassSendMail.tryTest: line 81, column 1: returning System.PageReference from method public System.PageReference send() in 4304 ms20100208225023.103:External entry point: returning from end of method static testMethod void tryTest() in 4808 ms
and
Resource usage for namespace: (default)Number of SOQL queries: 9 out of 100Number of query rows: 5 out of 500Number of SOSL queries: 0 out of 20Number of DML statements: 6 out of 100Number of DML rows: 6 out of 500Number of script statements: 90 out of 200000Maximum heap size: 804735 out of 1000000 ******* CLOSE TO LIMITNumber of callouts: 0 out of 10Number of Email Invocations: 1 out of 10Number of fields describes: 0 out of 10Number of record type describes: 0 out of 10Number of child relationships describes: 0 out of 10Number of picklist describes: 0 out of 10Number of future calls: 0 out of 10Number of find similar calls: 0 out of 10Number of System.runAs() invocations: 0 out of 20
I also get this error. We have a managed Package, and also a problem in test AND function. Everything was working fine in Winter'10
|FATAL_ERROR|System.VisualforceException: core.apexpages.exceptions.ApexPagesGenericException:
We found a solution for our problem
getContentAsPDF() instead getContent()