4

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?

1 Answer 1

9

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.

You must log in to answer this question.

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