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
deplaideplai 

trigger to send email to contact when task is marked public

I would like to write a trigger to send an email to the related contact of a task whenever the task is marked public.  Could someone give some direction on how to achieve this?  I'm fairly new to writing code.  Thanks.

Navatar_DbSupNavatar_DbSup

Hi,

You have to simply make the condition inside the trigger which will check for that public check box. Your trigger should be like this:

Trigger onPublicTash on task(after insert,after update)

{

If(publicCheckbox__c == true)//Custom  Checkbox field on Activity

{

 If(trigger.isinsert)

 {

 // Write the code for sending an emil to the associated contact.

 }

 If(trigger.isupdate)

 {

 // Write the code for sending an emil to the associated contact.

 }

}

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.