+ Start a Discussion
dkorba2k5dkorba2k5 

Spring '09 Apex/VF/PDF issues

Had a VF page and controller that was working fine until Spring '09 was installed.  It appears that any values in any public variables are maintained fine when rendered as HTML output and we get a single debug log.  However, if we renderAs="pdf", we end up with multiple log entries and the controller values are lost between the two separate logs resulting in a bunch of null value errors.  What's changed in Spring '09 and how do we accomodate for this?  An simple pseudo-code example would be:

 

public Account myAcct; public Account getAccount() { myAcct = ([SELECT name FROM Account where somecriteria]) System.debug('myAcct Name='+myAcct.name); } public getAcctName() { System.debug('myAcct Name='+myAcct.name); return myAcct.name;}

 


 

This is a simple example but the first debug statement works fine.  The second one returns a null error/value when rendering as PDF.  However, rendering as HTML doesn't have a problem.

 

Best Answer chosen by Admin (Salesforce Developers) 
dkorba2k5dkorba2k5

Issue solved thanks to Doug Chasman and this post:

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=9805

 

It's an issue with the Action function that is not guaranteed to run.  So we changed to a constructor instead and all is well.  This should be documented somewhere in the VisualForce documentation not to use that function.

Message Edited by dkorba2k5 on 02-11-2009 07:53 AM
Message Edited by dkorba2k5 on 02-11-2009 07:55 AM

All Answers

JeremyKraybillJeremyKraybill

Is your controller perhaps based on StandardSetController? Check out this thread which may shed some light. However, the problem you describe, which is similar to what is described in the thread, was present in Winter and apparently fixed in Spring 09 (I haven't seen the fix in action yet). Can you post your full controller and page code?

 

Jeremy Kraybill

Austin, TX

JeremyKraybillJeremyKraybill

In this thread, Doug Chasman says there is a known issue which they are working on a fix for right now, that seems more likely to be the cause of your issue. I'd suggest opening a support case to track the fix.

 

Jeremy Kraybill

Austin, TX

mtbclimbermtbclimber
Message moved to the Visualforce board.
dkorba2k5dkorba2k5

Issue solved thanks to Doug Chasman and this post:

 

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=9805

 

It's an issue with the Action function that is not guaranteed to run.  So we changed to a constructor instead and all is well.  This should be documented somewhere in the VisualForce documentation not to use that function.

Message Edited by dkorba2k5 on 02-11-2009 07:53 AM
Message Edited by dkorba2k5 on 02-11-2009 07:55 AM
This was selected as the best answer