What determines which tasks go into the boxes Open Activities and Activity history, respectively? I tried the fields Status, IsArchived, IsClosed, but none of them relate the image I see in my single Account page.
Task records, the differentiation is based on
Status. You can query for all closed values as follows:
Set<String> closedStatuses = new Set<String>(); for(TaskStatus status: [SELECT MasterLabel FROM TaskStatus WHERE IsClosed = true]) closedStatuses.add(status.MasterLabel);
Event records, the differentiation is based solely on the
StartDateTime field. If it is in the past, it is history. If it is in the future, it is open.
Event.EndDateTime >= TODAY() then it is open, otherwise it's history (no pun intended).– sfdcfoxOct 3, 2016 at 19:47
1@sfdcfox Not when I tested it to confirm. I did
EndDateTimetomorrow and it went into
Activity History.– Adrian Larson ♦Oct 3, 2016 at 20:03
That's curious. Maybe I just remembered it wrong. It wouldn't be the first time.– sfdcfoxOct 4, 2016 at 1:13