Reply
Regular Contributor
Nikvm257
Posts: 17
0
Accepted Solution

What is PageReference ??

Hello Guys ,

 

I am very new to cloud devlopment.

I am working on some vforce code devlopment.

I need to understand what is pagereference 

 

I have read the documentation but still couldn't clear myself.

 

So can  someone help me eunderstand in a layman terms what is the meaning of

 

}

public PageReference test() {
        return something; 
Thanks in advance !
Super Contributor
Rahul Sharma
Posts: 846
0

Re: What is PageReference ??

By writing this:

public PageReference test() { 
return something; 
}

you define the return type of the is function which is page reference.

Pagereference is used if you want to redirect the current page to another page.
 

Refer this documentation or more details : Pagereference Class

 

In below example you will find we have defined a new Pagereference variable newPage with url of google, and we use that variable for redirecting with returning it.

public PageReference test() {
PageReference newpage = new PageReference('http://www.google.com'); 
newpage.setRedirect(true);
return newpage;
 
- Rahul