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
FinneyFinney 

Case Comments Trigger

Hi

 

I have created a field on the Case object called Agent__c which is a lookup of the User.

 

When a user creates a new case comment and checks on PUBLIC checkbox, an email alert needs to be sent to the email id of the AGENT__C.

 

Can anyone please tell me how to do this.

 

Thanks

 

Finney

Maverick123Maverick123

Hi Finey,

 

You can do that by using a trigger. Here is the sample code:

 

trigger sample on CaseComment (after insert) {
set<Id>caseid = new set<Id>();
 for(CaseComment cc : trigger.new){
  cc.(theemailfield) = cc.ParentId__r.AGENT__C);
 }
}