+ Start a Discussion
Venky1219Venky1219 

Dealing with two vf pages having one controller

Hi all,

 

       I have Request__c object , I overridden new , edit , view by createRequest  , EditRequest , ViewRequest pages respectively and in createRequest page I have button to create request and controller have createRequest() method in this method I created new request__c object  with required Fields like request_type__c .

 

EditRequest ,ViewRequest both are sharing same controller ManageRequestController

 

Now I need to redirect page to EditRequest from createRequest() so I written following code

 

PageReference pRef = new PageReference ('/' + request.id );

pRef.setRedirect(true);

return pRef ;

 

So this code is opening ViewRequest instead of EditRequest . I need to redirect to EditRequest so please help me in doing this..

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Dhaval PanchalDhaval Panchal

Try this:

PageReference pRef = new PageReference ('/apex/EditRequest?Id=' + request.id );

pRef.setRedirect(true);

return pRef ;