I'm writing some Apex to list how many times a certain email has been opened. How can I access the "HTML Email Status" object from the lead?
List<Lead> leads = [SELECT Id, Email, (SELECT Id, Subject FROM ActivityHistories WHERE Subject LIKE 'Email: Hello, %.') FROM Lead];
for (Lead l: leads) {
if (l.activityHistories.size() > 0) {
System.debug('History: ' + l.activityHistories);
}
}
I don't think I can get the read count from the activity histories object, so what can I do to change it?