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
Nicole RocheNicole Roche 

Custom Field for Open Activities

I am trying to create a custom field to map my to with marketing automation tool to that will tell my if there is an open event on an account. So specifically an event, not an open task. Essentially I want to build a list off of this to exclude those contacts at these accounts from receiving automated emails. This is an indicator that my sales team has a scheduled conversation with them. Has anyone done this before?

 
BharathimohanBharathimohan
Hi Nicole,

There is no standard solution for this. I have worked on many of this functionality/logic. Here are the high level steps,

- Create a nightly scheduled job which will fetch a list of tasks and events LAST MODIFIED in the last twenty four hours
- Gather the set of Account IDs in a set by iterating over the task list obtained in step 1
- For those accounts, query for all the open tasks. If open task found, then mark the flag on account otherwise uncheck the flag
- For data consistency, run the same for all accounts once in a month
- Your code should also handle tasks deleted (so use ALL ROWS in soql)
- Determine to use Task object in your soql or Task Relation


Regards,
Bharathimohan Ramaurthy
Salesforce For All (http://salesforceforall.blogspot.com/)