How can i pass parameters from URL to Controller? I want to pass URL parameters to My controller class where i can query to fetch data with the help of these parameters.

1 Answer 1


You can catch URL parameters by referring them in this way:

Page name = ExamplePage


URL example = https://cs18.salesforce.com/apex/ExamplePage?yourParameter=90483753498hu76


In your controller, catch your parameter:

String yourParameterValue = ApexPages.currentPage().getParameters().get('yourParameter');

So, your String will have as value '90483753498hu76'

Now, you can query your data finding (e.g.) for your record using the parameter you just caught, i.e

Account exampleAccount = [SELECT Id FROM Account WHERE Id = :yourParameterValue ];

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .