Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I wish to create hyperlinks to a specific visual force page which displays a list of opportunities. The data in the page will need to be different. In some cases it will be all open opportunities above a certain value and in other cases it might be all opportunities not updated in last 6 months.

So, I am writing my own extension controller. I need to pass query parameters along the HTTP request to the extension controller so the extension controller knows what Opportunities to get for the page.

Is it possible to do this?

share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

Yes, you can do this with the getParameters method on the PageReference class. See this link for more details on that:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_pagereference.htm

For example, assuming you had the following URL parameters:

?a=1&b=2&c=3

In your code you can retrieve them like this:

String a = ApexPages.currentPage().getParameters().get('a');
String b = ApexPages.currentPage().getParameters().get('b');
String c = ApexPages.currentPage().getParameters().get('c');

Note, ApexPages.currentPage() returns a PageReference object.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.