Ask Search:
Paul SantosPaul Santos 

Force Default View to "All Leads" Under Leads Tab, not "Recent Leads"

I've searched a great many threads on this discussion board but was unable to find any recent information on my formatting question.

Our sales manager has asked me to configure the "Leads" tab's default view as "All Leads" such that he as the team leader can see all leads for all sales reps. He'd also like the default view for each individual sales rep to show "All Leads" that are assigned to them. Right now, it appears that Salesforce makes the default view for both the Sales Manager and the Sales Rep to be "Recent Leads.

All of the threads I found about this previously were at least a year old and talked about having to use Visual Force as a workaround. Is there no build-in capability to change the default list view to "All Leads" instead of "Recent Leads"? If not, why not? It would make the learning curve much easier for our non-technical users who want to see all leads they need to work. Also, if there's no built-in functionality, what's the most recently tested/working method to try and delve into this via Visual Force or some other method?

Thank you for the pointers,
Paul
Best Answer chosen by Paul Santos
Deepak AnandDeepak Anand
Hey Paul,

Yes. I have somethin for you. No Visualforce! No Apex! No Links! Nothing. Here you go:

  1. At first go to the Leads  tab and select All from the picklist and click Go.
  2. Notice the URL now. Should be something like: https://ap1.salesforce.com/00Q?fcf=00B90000004gsOu.
  3. Note fcf=00B90000004gsOu is what we need. The 00B90000004gsOu is the Id of the Custom List View - 'All'. Note it down.
  4. Go to Setup | Customize | Home | Home Page Components.
  5. From Custom Component, click New.
  6. Name: Redirector
  7. Type: HTML Area
  8. Next.
  9. On the Formatting Controls toolbar, look to the rightmost to see - Show HTML. Check it.
  10. Now copy the HTML as given below:
<script>(document.getElementsByTagName('h2')[0]).parentNode.parentNode.style.display = 'none';if(window.location.pathname=='/00Q/o')location.replace('/00Q?fcf=00B90000004gsOu');</script>

Note: Replace 00B90000004gsOu with the Id that you have in your Org i.e., the one you go in Step - 3.

Save it.

Now,
  1. Go to Setup | Customize | Home Home Page Layouts.
  2. We will have to Edit of all those Layouts followed by those Profiles to which your desired Users(those of whom who wants this)  actually belong to.
  3. After you click Edit, from the Select Narrow Components to Show section check the option - Redirector.
  4. Next.
  5. Don't mind the order. Leave it as it is and click Save.
Now go to the Leads tab and you will see that it will be loading with the All automatically selected.

A beautified version of the code to understand what we are doing:

<script>
(document.getElementsByTagName('h2')[0])
.parentNode
.parentNode
.style.display = 'none';
if(window.location.pathname=='/00Q/o')
location.replace('/00Q?fcf=00B90000004gsOu');
</script>
  • Everything before the if block helps to hide this little HTML Component. In other words the code to hide itself.
  • The if block checks if we are on the Leads tab if so then redirect to the specified URL.

#HowDYaLikeThis!

Best,
Deepak

All Answers

Jeff MayJeff May
You have concluded correctly -- the default view on the tab for each user is "Recent" items.  The "Views" at the top can be configured to show anything you want, but I don't know a way, other than custom Visual Force pages, to change that default.
Elizabeth DavidsonElizabeth Davidson
Your research serves you well.  This is a huge pain for most admins and users- I can't tell you how many times I had users call in a panic because a new account wasn't showing/etc, all because they expected it to be there on Accounts when they clicked (or other object) and it was only showing the recently viewed.  Since they'd not viewed the new account, of course it wasn't there.  Once reminded, they usually grew sheepish.

You could resolve this via visualforce but your best option at this time, in my opinion, is stronger training to make sure the users are utilizing the system correctly.  You can introduce them to the power of list views and if you have it enabled, edit line items in list views.  Everyone doesn't work the same way so forcing a change like this doesn't necessarily resolve all the problems and just creates more you have to maintain/review. 

I sincerely hope that we do get a setting to let us change that default view- or let the user set it as a personal preference so they can work in their best way.  Sometimes because you can make a change (via VF or code or anything) does not mean it's the best idea.  In some ways it is like the teach a person to fish and they can feed themselves parable.

If you want to go the VF way- and please vote up this Idea! here is a link to the Idea asking for the change in functionality and the code you need to use to create the VF page. 
https://success.salesforce.com/ideaView?id=08730000000BroGAAS
Ron SpillerRon Spiller
I don't have an answer  to force default but I can explain a way for your Sales Manager to quickly find the "All Leads" page. You can create Custom Links on the Home Page going to the List View(s). I use "All Leads" Today's Leads" "Leads Last Month" etc. You can also make links to commony used reports/dashboards, contacts etc.
Deepak AnandDeepak Anand
Hey Paul,

Yes. I have somethin for you. No Visualforce! No Apex! No Links! Nothing. Here you go:

  1. At first go to the Leads  tab and select All from the picklist and click Go.
  2. Notice the URL now. Should be something like: https://ap1.salesforce.com/00Q?fcf=00B90000004gsOu.
  3. Note fcf=00B90000004gsOu is what we need. The 00B90000004gsOu is the Id of the Custom List View - 'All'. Note it down.
  4. Go to Setup | Customize | Home | Home Page Components.
  5. From Custom Component, click New.
  6. Name: Redirector
  7. Type: HTML Area
  8. Next.
  9. On the Formatting Controls toolbar, look to the rightmost to see - Show HTML. Check it.
  10. Now copy the HTML as given below:
<script>(document.getElementsByTagName('h2')[0]).parentNode.parentNode.style.display = 'none';if(window.location.pathname=='/00Q/o')location.replace('/00Q?fcf=00B90000004gsOu');</script>

Note: Replace 00B90000004gsOu with the Id that you have in your Org i.e., the one you go in Step - 3.

Save it.

Now,
  1. Go to Setup | Customize | Home Home Page Layouts.
  2. We will have to Edit of all those Layouts followed by those Profiles to which your desired Users(those of whom who wants this)  actually belong to.
  3. After you click Edit, from the Select Narrow Components to Show section check the option - Redirector.
  4. Next.
  5. Don't mind the order. Leave it as it is and click Save.
Now go to the Leads tab and you will see that it will be loading with the All automatically selected.

A beautified version of the code to understand what we are doing:

<script>
(document.getElementsByTagName('h2')[0])
.parentNode
.parentNode
.style.display = 'none';
if(window.location.pathname=='/00Q/o')
location.replace('/00Q?fcf=00B90000004gsOu');
</script>
  • Everything before the if block helps to hide this little HTML Component. In other words the code to hide itself.
  • The if block checks if we are on the Leads tab if so then redirect to the specified URL.

#HowDYaLikeThis!

Best,
Deepak
This was selected as the best answer
Jeff MayJeff May
@Deepak -- you might have just become my new favorite person!
Paul SantosPaul Santos
Thank you all for the fantastic responses. Right now the schedule is a bit hectic, but I'm eager to try the work around the next chance I get. Wish I could give more than one "best answer". Thanks folks!
ranadheer reddy chaduvuranadheer reddy chaduvu
@deepak ....but I have a custom object ...it's not working for that. ....the custom object name country_matrix__c ....what may be the problem
Bing MaletzBing Maletz
@Deepak K Anand
Hi Deepak, many thanks for sharing the solution.  It takes 1 minute to set up, and works like a charm. It is true life saver!

@ranadheer reddy chaduvu
I applied the following code from Deepak for our customer object.  It works perfect.

<script>(document.getElementsByTagName('h2')[0]).parentNode.parentNode.style.display = 'none';if(window.location.pathname=='/00Q/o')location.replace('/00Q?fcf=00B90000004gsOu');</script>

To use the above code with your custom object, you need to do the following
  • replace /00Q/o with the URL extention (the text behind salesforce.com/) of your existing Country Matrix Tab
  • replace /00Q?fcf=00B90000004gsOu with the URL extention (behind salesforce.com/) of the "All" List view
Cheers
Bing
Gayatri PGayatri P
Hello,

I am unable to this on Opportunity.

<script>(document.getElementsByTagName('h2')[0]).parentNode.parentNode.style.display = 'none';if(window.location.pathname=='/006/o')location.replace('/006?fcf=00B11000000aiOD');</script>

Moreover,
I am getting my Component in "Select Wide Components to Show' section rather than "Select Narrow Components to Show"
Please help.
Courtenay GodshallCourtenay Godshall
I'm not seeing the show HTML button on the formatting controls toolbar? The last icon I see is for text highlighting?
Admin AdminAdmin Admin
I had the same problem and realised that the latest release no longer allows you to view/edit HTML within a text area. After a bit of playing around, the solution was to create a Visualforce page insead. Here is my code - it's a bit different as the window.location notation used above did not work within this Visualforce instance (as it is dropped into a home page layout).

<apex:page >
    <script>
        // Leads Page redirect
        if('{!$CurrentPage.URL}'.indexOf('%2F00Q%2Fo') > 0) {
            window.top.location='/00Q?fcf=00B90000009HsDw';
        }     
        // Accounts Page redirect
        else if('{!$CurrentPage.URL}'.indexOf('%2F001%2Fo') > 0) {
            window.top.location='/001?fcf=00B90000009HsVR';
        }     
        // Contacts Page redirect
        else if('{!$CurrentPage.URL}'.indexOf('%2F003%2Fo') > 0) {
            window.top.location='/003?fcf=00B90000009HsVW';
        }     
    </script>
</apex:page>

So step 1 is creating a visualforce page, step 2 is then creating a home page component and selecting Visualforce are and the created page from the dropdown of pages, and step 3 is the same step of adding this to the Home Page Layout.

As an aside, when I first followed the instructions above, it didn't work and I had to go into User Interface and tick Show Custom Sidebar Components on All Pages

......

This all works fine but the redirection looks a bit clumsy. Is there any way to delay the display until the redirection has happened? Maybe using javascript or jquery to hide everything in the DOM until after the redirection?
Claudia ContrerasClaudia Contreras
This is really good! THANK YOU!
Varada BhanageVarada Bhanage
Hi Admin,


How to check index of current page url.
E.g 
'{!$CurrentPage.URL}'.indexOf('%2F00Q%2Fo') 

Index is '%2F00Q%2Fo'.

Kindly help on this.


Regards,
Sneha
Chris LamChris Lam
Hi Sneha,

The Visual Force Page that Admin has created have a logic to re-direct Leads, Accounts, Contacts page into the customized home page components.  The current page URL determins the first page displayed when you clicked on the tab and by default displays the recent items.

At this point, you can look into the URL and determine the current page URL.

Note:  The current page URL needs to be URLEncoded.

For Example clicking on the accounts tab by default will display the below URL:

https://<Salesforce URL>/001/o

The current page URL will be /001/o
URL encoded will be %2F001%2fo

Hope this helps.

Regards,
Chris
Dan NapolitanoDan Napolitano
@Deepak Anand:

Thank you for posting this!

I thought I had your solution working with a custom VF page. I can post the VF code if it helps. Anyway, the solution seemed to work with my test user. However, my test user was in an account with one default community role type and I realized that I will need two roles for rollout.

I created a new partner account having an installer role and a supervisor role. Each corresponds to a profile that has its own home page. Of course, I made a new redirect for the supervisor role (the installer role was to use the original redirect), adding it to the supervisor home page.

These new roles simply did not seem to respect the redirect. They defaulted to Recently Viewed.

In the community, I tried changing the landing page from "default" to the VF page. This modified the URL construction from /001/o to /AA_Accounts_View (the name of my VF page). Next, I tried modifying the redirects to be FROM /AA_Accounts_View TO (one sample redirect) /AA_Accounts_View?fcf=00BG0000009N1JS. This did not work, either. There was also a longer construction (/AA_Accounts_View?j_id0%3Aj_id2%3Afcf=00BG0000009N1JS) that showed up in the URL when switching views by hand, and I tried using that. It also did not work.

When I tried to switch back the community landing page to "Default," it continued to redirect to /AA_Accounts_View, so I do not see 001/o any longer. 

I hope it's not a lot to ask, but I'm wondering if you have any idea why this isn't working? This is exactly the kind of solution I need--being able to create a distinct home page per profile and then have a custom redirect to the role/profile's preferred list view--but in a portal account with 2 or 3 roles, it doesn't seem to work. I'd be very grateful if you have an idea why and can steer me in the right direction. I can post any/all code you need.
Laura SquiresLaura Squires
I really want to use this solution, but I cannot locate the Formatting Controls toolbar. Any ideas?
Dan NapolitanoDan Napolitano
@Laura Squires, which edition of salesforce.com are you using?
Laura SquiresLaura Squires
Okay since I have to use the Visual Force Page what coding do I need? I want to use this for Cases.  /500?fcf=00B31000007I1Jw is where I want to go. Any help would be greatly appreciated.
Dan NapolitanoDan Napolitano
Is that view customized to each individual's assigned cases?
Laura SquiresLaura Squires
@Dan Napolitano, I am using Professional Edition
 
Laura SquiresLaura Squires
It’s for everyone to see, but there will only be one person who wants to have that as their default.
Dan NapolitanoDan Napolitano
Well, you can create this VF page:
 
<apex:page standardController="Case" tabStyle="Case" action="/500?fcf=00B31000007I1Jw" >
</apex:page>

Depending what else you want to do, you can get fancier, but that will show the list view you've indicated.
Laura SquiresLaura Squires
Thanks, but now my user is getting this error: Content cannot be displayed: You do not have sufficient privileges to access the page: /apex/Redirector
Dan NapolitanoDan Napolitano
Please remember that you have to assign permissions for the VF page (by profile). 

Go to Develop > Visualforce Pages and then click the Security link for your custom VF page. Assign appropriate access and retry.
Laura SquiresLaura Squires
Okay thanks, I am new to the Visual pages. Now they can see it on the Home page, but nothing happens when they clik on the Cases tab or any other.
Dan NapolitanoDan Napolitano
Have you overrriden the default page for the tab? That's Setup > Cases > Buttons, Links, and Actions > Cases Tab
Laura SquiresLaura Squires
No, I haven't. Just tried to and I don't see the new one I created in the Visual Force list.
Dan NapolitanoDan Napolitano
No worries. It should respond to a standard controller, but can use none. So change your VF page to this:
 
<apex:page tabStyle="Case" action="/500?fcf=00B31000007I1Jw" >
</apex:page>

Then go back and you should see it in the dropdown to replace the standard tab. If that works for you, please don't forget to give me a vote up or whatever indicating your problem is solved. Thanks!
Laura SquiresLaura Squires
That worked, but now other users are being re-directed, when i remove them from security it just tells them they have insufficient privileges. Yikes!
Dan NapolitanoDan Napolitano
Right. I think a bit of misunderstanding (probably my bad) in terms of your wanting to limit it to one user. Sorry. That's why I asked you if the view you constructed would show each person their own applicable records (because what I showed you how to do changes the default view of the tab for everybody). 

Naturally, you can back out what I suggested just by removing the override. 

I've had trouble with redirects and don't tend to trust them. As one user indicated above, the HTML redirect no longer works. The VF equivalent suggested by Admin Admin (above) may work for you. I haven't actually tried it, because I solved my problem (a bit different than yours) another way. Have you tried using the Admin Admin solution? If so, what happened?
Laura SquiresLaura Squires
@Dan Napolitano I have tried putting that together but am not familar with what the code should be for Cases.
Dan NapolitanoDan Napolitano
It's 500?fcf= for cases.
Laura SquiresLaura Squires
Do I leave the case tab set to default? 
Dan NapolitanoDan Napolitano
If you mean, otherwise let it remain at Recently Viewed, yes. The solution described above perceives you've landed on that tab and redirects to your preferred view.
Laura SquiresLaura Squires
It goes to a blank page when I click on the case tab. I must have something incorrect in the code:
if('{!$CurrentPage.URL}'.indexOf('%2F00Q%2Fo') > 0) { window.top.location='/500?fcf=00B31000007I1Jw';}
Dan NapolitanoDan Napolitano
Yes, your index is incorrect. It's still listed for leads.
Mariza PandoMariza Pando
This doesn't work. the Show HTML function is not available anymore when you follow step 9. After finished with the steps, the default tab is not the one you are trying to redirect, but still recent items.
Mukesh KumarMukesh Kumar
Can anybody show me this option.
On the Formatting Controls toolbar, look to the rightmost to see - Show HTML. Check it.

I tried multiple times but there is no any Show HTML checkbox visible.

Thanks.
Mukesh
Surekha KSurekha K
Hello everyone,

Can anyone help on how to get the Default View to "All Leads" Under Leads Tab instead of "Recently viewed"  in salesforce1 and Lightning.

Thanks,
Surekha
Mark ThomasMark Thomas
Has Salesforce rolled out a non-coding way to modify the default List View that a user gets taken to when coming to the Opportunities/Leads/Accounts/Contacts screen in Lightning? I don't always want to keep coming back to "Recently Viewed".
Elizabeth DavidsonElizabeth Davidson
You are in luck!! This is on the road map for lightning and was announced at Dreamforce. I’m sorry I don’t have more specifics!
Mark ThomasMark Thomas
Cool that's great to hear. Thanks Elizabeth.
Veena R NairVeena R Nair
Hai Everyone.....
Is there any way in salesforce to change the default list view to custom list view for a custom object?
 
Gulshan KrishnagiriGulshan Krishnagiri
Does any one know, how to make this work on Lightning?