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
Swapnil PatneSwapnil Patne 

Displaying activity history of specific record type in visualforce page

Hi,

I am not a developer but trying to create an extension controller for activity history so as to display/pull account activity histrory/Event records on visualforce page filtered by specific record type activities. i.e. trying to apply filters in the class Activity_Type__c ='Value Pillar'  but doesn't work 

This code may be partially or completely wrong but can someone help me in the right direction with the code?

Here is the code that I have managed to get hold of from community and modified it a bit :


public class ActivityHistoryControllerExten {
    
    private final Account acct;
    
    // The extension constructor initializes the private member  
    // variable acct by using the getRecord method from the standard  
    // controller.
    
    public ActivityHistoryControllerExten(ApexPages.StandardController stdController) {
        this.acct = (Account)stdController.getRecord();
    }
    
    //this is the logic for the extension
    
    public String getName() {
        return 'ActivityHistoryControllerExten';
    }
        
    public Account getAccount() {
        return [select id, name, ownerid, (select subject from ActivityHistories 
                     where Activity_Type__c ='Value Pillar' ) subject //filter out marketing actvities 
                from account
                where id = :ApexPages.currentPage().getParameters().get('id')];
    }

}

Thanks in advance.

Swapnil