+ 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);
 }
}