You need to sign in to do that
Don't have an account?
Steven Buelow 17
Can I override the last list Filter viewed on a StandardObject Controller on instantiation without a custom controller?
Hi, I'm actually trying to find out if there is an easy way to do this. I'm looking to use as much non-custom class salesforce as possible.
I'd like to create a Apex:Page.StandardController:User that does something like this:
But as I've read, vaguely, the system defaults to the last viewed Filtered list of that Object Type. We're instructed to use something like this:
My Question: Can I programatically set the fcf value on the StandardObject User as it pulls the information for the view? I DON'T want this to be user selected. I'd like it to be a forced selection that whenever they'd go to a specific page, they'd get a specific view.
Can this be done without a custom controller OR any .JS hacking?
I was hopeing for something like
I'd like to create a Apex:Page.StandardController:User that does something like this:
<apex:pageBlock> <apex:pageBlockTable value="{!users}" var="a" > <apex:column value="{!a.name}"/> <apex:column value="{!a.ProfileId}"/> <apex:column value="{!a.UserRoleId}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
But as I've read, vaguely, the system defaults to the last viewed Filtered list of that Object Type. We're instructed to use something like this:
<apex:panelGrid columns="2"> <apex:outputLabel value="View:"/> <apex:selectList value="{!filterId}" size="1"> <apex:actionSupport event="onchange" rerender="opp_table"/> <apex:selectOptions value="{!listviewoptions}"/> </apex:selectList> </apex:panelGrid>
My Question: Can I programatically set the fcf value on the StandardObject User as it pulls the information for the view? I DON'T want this to be user selected. I'd like it to be a forced selection that whenever they'd go to a specific page, they'd get a specific view.
Can this be done without a custom controller OR any .JS hacking?
I was hopeing for something like
<apex:page standardController="User" recordSetVar="users" tabstyle="user" sidebar="false" fcf="00Bo0000002sTnZ">
This is a little more tricky that it might appear at first glance - you have to assign a value to the controller property 'filterId' and there isn't a standard component that supports this.
and then set this from the page as follows: It has a somewhat clunky feel to it, but works.I use a simple custom component as follows:
Go to Settings>Develop>Components and we see the "Visualforce Components" at the top of the page. Create a new component. Paste in your above code as is: Then go to your visualforce page and paste in : * from will equal whatever page you want to reference (you find it by looking at your URL bar and copying the fcf="somestring"
for those who are super green.
Now everytime you load your page it automatically would set the custom list you have created on the Account, Opportunity, or whatever. Custom lists view being the pull down list you see when you click on the standard Tab of accounts or opportunities.
Bonus: It doesn't actually change the view pull down list, so you can run it and not have to worry about your View tab changing.
Why do all this?
- You can use the standard admin level report and report filtering strategies you probably use every day in making custom reports from the GUI.
- It knows the users record view access from what I can tell, so people who shouldn't see the data still shoulding, while a custom query may not always behave in this way and you'd have to add some logic there to check that.
- This should be a standard setter method of the Sobject considering it's doing it anyways with {filterId}
- You don't have to make a custom class or know a ton about MVC to make this work... I know a lot of people out there want to customize salesforce in very slight ways and this helps (mainly since we can't simply request reports values and load them into an object)
Bob feel free to pile on and correct me, obviously, I've outlined this assuming more people are like me (novice apex users) and less are like you (smart code writers who understand some of the odd nuances of this language).