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.

1 Answer 1


For 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])

For 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).
    – sfdcfox
    Oct 3, 2016 at 19:47
  • 1
    @sfdcfox Not when I tested it to confirm. I did StartDateTime yesterday and EndDateTime tomorrow 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.
    – sfdcfox
    Oct 4, 2016 at 1:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .