You need to sign in to do that
Don't have an account?
Emails not being sent on new case comment through apex
I've been trying to do this by setting the DML options, but it doesn't seem to be working.
Stuck as to what I'm doing wrong.
This is the code I'm using:
public PageReference doSave()
{
List<sObject> sList=setCon.getSelected();
List<CaseComment> ccList=new List<CaseComment>();
for(sObject s:sList)
{
s.Put('Status',CaseStatus);
s.Put('Reason',CaseReason);
if(!String.isBlank(Comment))
{
ccList.Add(new CaseComment(CommentBody=Comment, ParentId=(Id)s.Get('id'), isPublished=PublicComment));
}
}
if(!ccList.isEmpty())
{
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.EmailHeader.triggerAutoResponseEmail = true;
dmlOpts.EmailHeader.triggerOtherEmail = true;
database.insert(ccList,dmlOpts);
}
return setCon.save();
}
Is that in sandbox?
Have you checked the email deliverability settings?
-Hengky-
See Force.com Apex Code Developer's Guide (https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_class_Database_EmailHeader.htm).