You need to sign in to do that
Don't have an account?
Rahul Allada
Error: Too many nested getContent calls
I am trying to attach my Vf page which is rendered as pdf to the Files section. But the error " Too many nested getContent calls." is being thrown.
The code is as follows:
Apex Controller:
Not able to figure why this error is being thrown.
The code is as follows:
<apex:page action="{!attachOfferPDF}" standardController="Quote__c" extensions="QuotePDFController" readOnly="true" applyHtmlTag="false" sidebar="false" showHeader="false" cache="true" renderAs="pdf">
Apex Controller:
public with sharing class QuotePDFController { public PageReference rtn; public static string recursion = 'false' ; public string parId; public quote__c quotesRecords {get;set;} public Quote_header__mdt quotesHeaders {get;set;} public QuotePDFController(ApexPages.StandardController standardController){ quotesRecords = new Quote__c(); parId = standardController.getId(); system.debug('parid '+parId); quotesRecords = [select Id,Name, (SELECT Id, Product_Name__c,DifficultyLevel__c,Product__r.Name,Level_Course__c,Onetime_Fee__c,OS__c,Vlab_Configuration__c,PerHourCost__c,PerChallengeEvaluationFee__c FROM Quote_Line_Items__r) FROM Quote__c where Id = 'a071y0000015mwEAAQ' limit 1]; } public void attachOfferPDF() { if ( recursion == 'false'){ recursion = 'true'; system.debug(recursion); PageReference pdfPage = Page.QuoteGeneration; Blob pdfBlob = pdfPage.getContentAsPDF(); Attachment a = new Attachment(parentId = 'a071y0000015mwEAAQ', name='Rahul' + '.pdf', body = pdfBlob); insert a; system.debug('id is '+a.id); }} }
Not able to figure why this error is being thrown.
Try the suggestions as mentioned in the below developer discussion,
https://salesforce.stackexchange.com/questions/83275/too-many-nested-getcontent-calls
For further reference check this,
https://developer.salesforce.com/forums/?id=906F000000097DbIAI
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.