function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Venkata Sumedha singanamalaVenkata Sumedha singanamala 

Usage of Pagereference


Can any one explain me when,where and how to use "pagereference"??


This is the link

What : PageReference is class in APEX and have many methods. 

Where and How :

1) You can use this class in your Apex class. Suppose you have provide a save button on your UI and want user click on save button then data will save in database and user will redirect to another page.0

PageReference myMethod(){
//-----provide you logic here and then redirect user to thankyou page. 
PageReference x = new PageReference('/apex/thankyou');
return x;
2) When you want to redirect user to next page with parameter or you want to get some value from parmeter than PageReference class has provide some method to get the valiue of parameter from URL in apex class

Venkata Sumedha singanamalaVenkata Sumedha singanamala
Thank you.. :)