Hey Guys,
Here is the solution for Counting Activity Histories or Sum of Activity Histories ,
Lets take example of ACCOUNT's Activity Histories
private List<String> contactIdList; // Variable declaration
contactIdList = new List<String>(); // put this line under the constructor
public List<Account> getCountofActivityHistories() {
return [ select Name, Type, Owner.Name, Referring_Contact__c, CreatedDate, (select Id from ActivityHistories) from Account where Referring_Contact__c in :contactIdList order by Name limit 1000 ];
}
Here is the solution for Counting Activity Histories or Sum of Activity Histories ,
Lets take example of ACCOUNT's Activity Histories
Apex Controller
private List<String> contactIdList; // Variable declaration
contactIdList = new List<String>(); // put this line under the constructor
public List<Account> getCountofActivityHistories() {
return [ select Name, Type, Owner.Name, Referring_Contact__c, CreatedDate, (select Id from ActivityHistories) from Account where Referring_Contact__c in :contactIdList order by Name limit 1000 ];
}
Visualforce Page
<apex:pageblocktable value="{!CountofActivityHistories}" var="item">
<apex:column headerValue="Number of Activities">
<apex:outputText value="{!item.ActivityHistories.size}"/>
</apex:column>
</apex:pageblocktable>
No comments:
Post a Comment