Can List view parameters be passed in via the URL?
One thing you can do is define your list and filter and then call it using URL.
https://na3.salesforce.com/00Q?fcf=00B90000008505L
here fcf=XXXX is the id of list view.
Note that the criteria is predefined and can not change dynamically.
If you wan to to change filter dynamically then you will have to write your custom page with VF & APex.
You can, actually, change the list view criteria dynamically. Start by pulling up the list view you want to call and clicking into the Edit screen for it. Here you need to do 2 things:
- Copy the URL.
- Right click on the criteria field where you'll be passing in a value. Click on Inspect Element. (Note: I've only tried to set the filter values via parameter passing, not the field or operators. Also, these steps are for Chrome.)
3. Look for the input id that shows up in the developer tools section. Copy it. Repeat for as many filter values as you'll be passing (and remember the order so that you can pass your data into the right filters).
When I did this for an Activities list view, the input ids were "fval1", "fval2", etc.
To build your url for your link or button, you need to start with the url you copied from the edit page. Mine looked liked this:
https://cs20.salesforce.com/ui/list/FilterEditPage? id=00Bm0000000Zt9H&retURL=%2F007%3Ffcf%3D00Bm0000000Zt9H %26rolodexIndex%3D-1%26page%3D1
You can actually delete the part of the url after the second repetition of your list view id. The list view id has been bolded in my url above, and the part you can delete has been italicized.
To add your dynamic criteria, follow the same principles as regular url passing but with the input id(s) you identified earlier, **making sure to add a Save parameter*. In my example, I want to open a list view with all activities related to the Account the button is on: https://cs20.salesforce.com/ui/list/FilterEditPage?id=00Bm0000000Zt9H&fval1={!Account.Name}&save=1&retURL=%2F007%3Ffcf%3D00Bm0000000Zt9H
A few final notes:
- The retURL will load the list view after the edit you passed in is saved.
- Make sure you've saved your list view with the Filter field(s) and operator(s) already set!
- This process modifies this list view every time a user clicks your custom link/button, so if accessed through a tab, it will display the most modification. (I haven't tried it, but you may be able to use the List View name - fname/devname - in your url to somehow create a new list view with every click or for each user, but that could very quickly get out of hand.)
- This same thing can be done via parameter passing to a report, and probably fulfills your business requirements better and more easily.