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
Ramya BalakrishnanRamya Balakrishnan 

how to call visual page from another visual page

Hi all
I would like to call a visual page(AddCertifications) from another visual page(ProfileUpadate) in button click. But nothing is coming when i click the button.This is my code
PageReference p = new PageReference('/apex/AddCertifications?id='+cid);
p.setRedirect(true);
return p;

The requirement is when i click the upload button in ProfileUpadate page , the AddCertifications page will open for uploading file.Both the pages extends different controllor. How to achieve this one? 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Ramya,

Can you check the solution mentioned in the below stack exchange question. I hope you also have the similar requiremrnt.

https://salesforce.stackexchange.com/questions/117217/how-to-call-another-visualforce-page-from-an-apex-command-button

If this solution helps, please mark it as best answer.

Thanks,
 
Nitin ShyamnaniNitin Shyamnani

Hi Ramya,

you have 2 options for this

1. using apex

PageReference pr = new PageReference('/apex/AddCertifications');

pr.getParameters().put('id',cid);

pr.setRedirect(true); 

return pr;

 

2. using JS

<button onclick="window.location.href='/apex/AddCertifications?id={!cid}'; "> click </button>