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
Vance CochraneVance Cochrane 

How can I update a custom field after pressing the "Send An Email" button in Lead Activities list?

I have a custom field defined in an Activity. What I would like to do is to update this custom field when the "Send An Email" button is pressed (or after the email is sent). Essentially, this field is used to track the type of activity and I want to have this "activity type" updated when the email is sent.

 

Any ideas on how I can accomplish this?

 

Thanks in advance.

ForceWaveForceWave
I guess you can write a tirgger on Task before Insert  and add condition if subject contains "Email" as follows:

trigger updateActivityTypeField on Task (before Insert){

for(Task tk:trigger.new){
//Add this if you want fire trigger only for the emails
// Add more conditions if you have any
if(tk.subject.Contains('Email')){

tk.activtyType__c='your value';

        }

 }


}

Let me know If that help you start.
Good luck.