function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
guest1231231guest1231231 

Filter View Activity History Screen

Would like to extend the capability of the "View All" button under the Activity History section to only return activities assigned to certain users.

 

Where can I get the source code for the View Activity History? 

 

How would I go about creating the filter?

 

I've developed using Apex but I am new to VF.

 

-Thanks

Jeremy.NottinghJeremy.Nottingh

For some reason, Task does not have a standard set controller, which means your "View All" button would have to go to a Visualforce page with a custom controller behind it.

 

At this point, all your filtering and pagination would be handled by the Apex class, and the page itself might not have to be too complex. Good luck!

 

Jeremy

guest1231231guest1231231

I built this controller extention and page only to find out that I can only use them in account buttons, which means I can't override the Activity History View All button which was my original intention.

 

What is the best approach to override the Activity History View All list button?

 

Also, is there anyway to link to the task record from  <apex:column value="{!hist.subject}"/>?

 

-Thanks

 

Page...

 

<apex:page standardController="Account" extensions="ActivityHistoryControllerExt">
  <apex:sectionHeader title="{!$ObjectType.ActivityHistory.label} For {!Account.Name}" />
    <apex:pageBlock >
        <apex:pageBlockTable value="{!Account.ActivityHistories}" var="hist">
            <apex:column value="{!hist.subject}"/>
            <apex:column value="{!hist.whoid}"/>
            <apex:column value="{!hist.accountid}"/>
            <apex:column value="{!hist.ownerid}"/>
            <apex:column value="{!hist.activitydate}"/>
            <apex:column value="{!hist.description}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 

 

Class...

 

 

public class ActivityHistoryControllerExt {
	
	private final Account acct;
    
    // The extension constructor initializes the private member  
    // variable acct by using the getRecord method from the standard  
    // controller.
	
	public ActivityHistoryControllerExt(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
    }
	
	//this is the logic for the extension
	
	public String getName() {
		return 'ActivityHistoryControllerExt';
	}
        
	public Account getAccount() {
		return [select id, name, ownerid,
					(select subject, whoid, whatid, accountid, ownerid, activitydate, description from ActivityHistories 
					 where ownerid not in ('00500000006yDel','00500000006rEaU','00500000006r6vK','00500000006xt0W') ) //filter out marketing actvities 
				from account
				where id = :ApexPages.currentPage().getParameters().get('id')];
	}

}