You need to sign in to do that
Don't have an account?
CloudHugger2
contentAsPDF renders the wrong page
Hi All,
Simple, consistent issue - and no feedback from Salesforce via the partner portal in weeks. Hoping others may have seen this.
The following simple logic has me stumped and is consistent in its results.
Assume user calls the following via a commandbutton that is on Page A:
PageReference p = Page.B; p.getParameters().put('id', <someid>); Blob b = p.getContentAsPdf(); attachment a = new attachment(parentid = ..., body = b, name = 'test.pdf'); insert a;
The attachment ends up a render of Page A, the current page user is looking at, NOT page B as you'd expect.
Has anyone else experienced this? I have two totally different environments producing the same outcome described above consistently.
Cheers,
CloudHugger
Righto - solved this one.
I was sharing the controller across both pages A and B, so the view state was persisting. Once I created a controller specific to the page I was trying to render things became more predictable.