Sales Lead object function callable by external systems to get number of related activities
We have a requirement to create a Sales Lead object function to get the number of related activities. If the age of the lead is 45 days old or more && the number of activities is 0, we need to setAttribute('StatusCode','RETIRED). That should be done in scheduled process ESS job, which is why we need to make the function callable by external systems. We know how to setup the ESS job but the script is what we are needing help with.