function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sdondetisdondeti 

Finding open events and tasks of a Lead and closing them

Hi,

I got a requirement to close all the open events and tasks of a Lead when it reaches a specific status. I did some analysis and figured out that it is possible only with a trigger.

As to closing the Tasks, I queried Task object using "WhoId" field and set the Status to Completed which closed all the tasks of a Lead.

However for the events, I am not seeing a status field in the Event object. I was wondering how can we close the open events for a lead. Is it by setting the eventdate=currentdate Or any other mechanism?

Would appreciate your help.

Thanks
Best Answer chosen by sdondeti
pconpcon
That would be correct.  Events are not like Tasks.  Tasks have a status where an event is based on a given range of time.  You can set the EndDateTime and the ActivityDateTime to now that should "close" out the Event.