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
Jonny SimmoJonny Simmo 

How can you get CurrentPage.parameters from the VF page to the controller?

Hello there,

I have a Visualforce page in which I am using some CurrentPage.parameters, I understand how to use and reference these within the Visualforce page, but if I want to pass the value back to a variable in my Apex Controller, how do I do that?

I basically want to store a CurrentPage.parameters value in the database, so I want to get it from the VF page back to the controller so I can include it in a record I write to the database.

Any help much appreciated.
 
Best Answer chosen by Jonny Simmo
Sagar PareekSagar Pareek
you can use below statement in your apex code
 
ApexPages.currentPage().getParameters().get('id')

where id is the name of parameter 

All Answers

Sagar PareekSagar Pareek
you can use below statement in your apex code
 
ApexPages.currentPage().getParameters().get('id')

where id is the name of parameter 
This was selected as the best answer
Jonny SimmoJonny Simmo
Thanks Sagar, that has worked!!

Easy when you know how, I tried lots of different approaches with no success.

Thanks!!