Hi Salesforce experts,
I have a question about account performance. I would like to request updates based accounts in the activityHistory object. The problem I get is that all accounts are retrieved whether or not there is a “full” active history. So, is there a way to write this query to retrieve only accounts with activeHistory that have status = "complete" and Type_for_reporting = 'QRC'?
List<Account> AccountsWithActivityHistories = [
SELECT
Id
,Name
,( SELECT
ActivityDate
,ActivityType
,Type_for_Reporting__c
,Description
,CreatedBy.Name
,Status
,WhatId
FROM ActivityHistories
WHERE Status ='complete' and Type_for_Reporting__c = 'QRC'
)
FROM Account
];
source
share