You need to sign in to do that
Don't have an account?
Lisa Haigy 41
Trigger to add a case feed comment if it received from a certain email
I have a trigger on cases that if an external email is received from a certain email, it adds a comment on the case feed. Is there a way to add a highlight to these comments so it stands out to the user? Below is my trigger
trigger CaseTrigger on Case (after insert) {
List<caseComment> caseCommentList = new List<caseComment>();
for (Case t: Trigger.new)
{
caseComment cc = new caseComment();
if(t.ContactEmail == 'abcemail@thisemail.com'){
cc.parentid = t.ID;
cc.commentbody = 'For all interactions with Crystal, please ensure that Stephen is also cced on the email';
cc.ispublished = true;
casecommentlist.add(cc);
}
if(t.ContactEmail.Contains ('@abccompany.gov')){
cc.parentid = t.ID;
cc.commentbody = 'For all interactions with abc company, please ensure that all Team Members are copied';
cc.ispublished = true;
casecommentlist.add(cc);
}
if(t.ContactEmail.Contains ('@abc.edu')){
cc.parentid = t.ID;
cc.commentbody = 'For all publishes, please notify abc in advance';
cc.ispublished = true;
casecommentlist.add(cc);
}
}
insert caseCommentList;
}
trigger CaseTrigger on Case (after insert) {
List<caseComment> caseCommentList = new List<caseComment>();
for (Case t: Trigger.new)
{
caseComment cc = new caseComment();
if(t.ContactEmail == 'abcemail@thisemail.com'){
cc.parentid = t.ID;
cc.commentbody = 'For all interactions with Crystal, please ensure that Stephen is also cced on the email';
cc.ispublished = true;
casecommentlist.add(cc);
}
if(t.ContactEmail.Contains ('@abccompany.gov')){
cc.parentid = t.ID;
cc.commentbody = 'For all interactions with abc company, please ensure that all Team Members are copied';
cc.ispublished = true;
casecommentlist.add(cc);
}
if(t.ContactEmail.Contains ('@abc.edu')){
cc.parentid = t.ID;
cc.commentbody = 'For all publishes, please notify abc in advance';
cc.ispublished = true;
casecommentlist.add(cc);
}
}
insert caseCommentList;
}
I was thinking about updating a rich text area field. Unfortunately case comment object is not customizable so we cannot add any custom field
https://success.salesforce.com/ideaView?id=08730000000BpLoAAK
Were you able to acheive this?
Anudeep