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
Jyoti Singh 9Jyoti Singh 9 

Page redirect not working in VF

Hello,

I try to redirect control from one VF page to another using
 
Public Pagereference go(){
    PageReference pageRef = new PageReference('/apex/MyController?id={!objId}');
    pageRef.setRedirect(true);
   // return pageRef;
   }

but it not works. There is no error, please help to resolve.
Best Answer chosen by Jyoti Singh 9
Gaurav KheterpalGaurav Kheterpal
It should actually be
 
PageReference pageRef = new PageReference('/apex/MyController?id=' + orderId.id);
This should fix it

If my answer helps resolve your query, please mark it as the 'Best Answer' to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Developer Forums Moderator| Dreamforce Speaker