+ Start a Discussion

Updating a record and opening a new page????

Hi I like to do 2 things with one button on my VF page...

1. Export everything on the page to excel

2. Update a field to today date and time (System.Now());



I tried this but it is updating first and then exporting blanks...


public pageReference init(){
pagereference home = new pagereference('/apex/excel');
return home;    



In my excel method I am taking in all Opps with the date/time field blank...

But the excel is coming out blank because it is updating before it is exporting it out...

Any thoughts






I am little confused about your issue but  an idea..

After updating the field your re-directing to th apex page "excel" right?

so to view the updated record you have to pass the recordID to your excel page and

display the records in the VF.

Please state your issue clealry with some codes.