The Problem

We're experiencing a problem where users are getting an "Insufficient Privileges" message when using an <apex:commandButton> to view Activity History. The users are the Lead owners.

The Setup

We use a Visualforce wrapper for the Lead, embedding the standard layouts with <apex:detail inlineedit="true"/>. After this we have custom related lists, including one for Activity History that only shows users their own activities.

Relevant VF:

<apex:pageBlock title="Activity History" id="myActivities">
        <apex:pageBlockButtons location="top">
            <apex:commandButton value="View All" 
              action="{!URLFOR($Action.Activity.ViewAll, Lead.Id)}"/>
   // Other code

When a user clicks this "View All" button, they get the following message:

Insufficient Privileges You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary


If I add the standard Activity History related list back to the page layout then my custom button works. As soon as I remove the standard related list my button breaks again. Inspecting the URL the two buttons generate did not yield much, either:

The standard button uses the following JavaScript in the onclick event:


The link generated by {!URLFOR($Action.Activity.ViewAll, Lead.Id)}:


I can also replicate this in my dev org. Steps to replicate:

  1. Create/assign a user to the Standard User profile.
  2. Create/assign a Lead to the test user.
  3. Ensure the standard related list is on the page layout.
  4. Login as the test user.
  5. Record a completed Activity.
  6. Verify the test user can follow the View All Activity History button.
  7. Login as an Admin. Remove the Activity History standard related list.
  8. Login as the test user.
  9. Try to navigate to https://[instance].salesforce.com/ui/core/activity/ViewAllActivityHistoryPage?id=[lead], replacing [instance] and [lead] with appropriate values.
  10. Receive Insufficient Privileges error.


  • The View All Activity page is the standard Salesforce page and is not overridden at all.
  • Trying to navigate directly to https://cs2.salesforce.com/ui/core/activity/ViewAllActivityHistoryPage?id=[lead] fails when the related list is hidden.

Update 2013-Dec-19

It turns out that this happens even with the default System Admin profile.

  • 2
    Salesforce support has sent my case to the Page Layout team.
    – Mike Chale
    Commented Dec 19, 2013 at 20:12
  • Have they acknowledged it is a bug yet? It is really odd behavior. Commented Dec 20, 2013 at 13:18
  • 1
    No, it has not yet been marked as a bug, but I think that's just because it hasn't reached the right team yet.
    – Mike Chale
    Commented Dec 20, 2013 at 13:37

2 Answers 2


I can replicate the same thing that you are observing.

I have a "workaround". I was able to reverse engineer the Go to List >> links on the related list when there are more than the default number in the list (more than 5 for me) on the page.


I built the following URL:


The rlid parameter specifies the related list.
The id parameter specifies the Id of the Lead.

This isn't as good as directly accessing the built-in $Action.Activity.ViewAll, of course, and it looks like you probably found a defect, but maybe you can use this in the mean time. It does work when the related list is not on the page layout.

  • That's really weird that crafting that URL works, but not using $Action. I'll definitely try that out as a workaround.
    – Mike Chale
    Commented Dec 20, 2013 at 13:35
  • Yeah. It really looks like a bug. Commented Dec 20, 2013 at 13:43
  • 2
    Wish I could double vote this up, sweet work around. Commented Dec 20, 2013 at 23:02
  • 1
    With this as a feasible workaround while the Salesforce team works on the issue, I am going to award the bounty. Good find Peter. Commented Dec 23, 2013 at 17:04

I received a response from Backline Support:

The behavior reported in this case is expected. When the Activity History related list is not on a user's Page Layout for a given record, the user will receive an Insufficient Privileges error if attempting to access the ViewAllActivityHistoryPage for that record. This is by design.

The suggested workarounds were to:

  • Use the link as Peter suggested above (which is, of course, unsupported)
  • Have a custom link leading to an Activity Report
  • Use Visualforce for a custom solution

I have started an Idea to have this behaviour changed - see Allow View Activity History Without the Related List Being on the Page Layout


Salesforce has added a knowledge article documenting this behavior.

You must log in to answer this question.

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