I have a scenario where I wound choose a command link value based on the chosen value an action will be performed for "next" button in the third page which is a common page for both the command link value..Say, if the links are "COD" and "Online".Both the links will be redirect to a page called "verify" which has a next button.But here, if I have chosen "COD" it will go to "Success" page and if its "Online" it will go to "providedetail" page..How to pass the value of the first page to the third page and perform action based on the selected link?

Thanks in advance,


would suggest you use a query string parameter to pass the value to the subsequent pages.

Pagereference pageRef = new PageReference('/apex/customPage');
return pageRef;

As suggested above, passing a parameter is great for a single value.

An alternative is to use the same Apex controller on each page. If you do that (and don't use setRedirect(true) on the PageReference), the state of your controller will be kept as you move from one page to another. Then you can just store the value in one of the properties of your controller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.