You need to sign in to do that
Don't have an account?
Ashan
Getting content from within triggers is currently not supported.
When I try to call PageReference.getContent() from a trigger, I get the following error.
Getting content from within triggers is currently not supported.
Do anyone have a solution for this?
Can you elaborate what you are trying to do with the PageReference.getContetnt() ?
You may need to call out to an async (@future) method to getContent. Some features aren't allowed in triggers because they can require too much time during the transaction.
PageReference pdf=Page.DsignationLetter;
pdf.getParameters().put('id',employeeId);
Blob body;
body = pdf.getContent();
@JPClark3
I tried to do it in a @future method. But then the page is not rendred properly. When i looked at the content there is a url which directs to the page, but it needs to log again to salesforce
When you fire a trigger your in the process of commiting the data and the page is out of reference. The same thing applies for @future methods.
Keep in mind triggers could be processing up to 200 records at a time so you cannot redirect either.
Are you firing off this process from a click on a VF page? If you are, use an extension class to handle this function.