You need to sign in to do that
Don't have an account?
deepak1.3956330618074822E12
Invalid Email address error when trying to put a comment through trigger
The piece of code goes as below. When a case is updated, i am getting the following error.
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger CommentUpdate caused an unexpected exception, contact your administrator: CommentUpdate: execution of BeforeUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, E2CP.SetMostRecentPublicComment: execution of AfterInsert caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Invalid to address : null: [] (E2CP): []: Trigger.CommentUpdate: line 12, column 1".
Seems its related to Email to Case premium but not able to figure out how to fix this.
I am trying to put a comment through this trigger. When the field Case Summary Changed equals Yes, then the case summary in the field Case_Status_Updates__c should be updated as case comments. The code is failing when i am trying to Insert the new comment (last line).
trigger CommentUpdate on Case (before update) {
List<CaseComment> NewComment = new List<CaseComment>();
for(case c:trigger.new){
if(c.Case_Summary_Changed__c == 'Yes'){
CaseComment com = new CaseComment();
com.ParentId = c.id;
com.IsPublished=FALSE;
com.CommentBody= c.Case_Status_Updates__c;
NewComment.add(com) ;
}
}
Insert NewComment;
}
Regards
Deepak
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger CommentUpdate caused an unexpected exception, contact your administrator: CommentUpdate: execution of BeforeUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, E2CP.SetMostRecentPublicComment: execution of AfterInsert caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Invalid to address : null: [] (E2CP): []: Trigger.CommentUpdate: line 12, column 1".
Seems its related to Email to Case premium but not able to figure out how to fix this.
I am trying to put a comment through this trigger. When the field Case Summary Changed equals Yes, then the case summary in the field Case_Status_Updates__c should be updated as case comments. The code is failing when i am trying to Insert the new comment (last line).
trigger CommentUpdate on Case (before update) {
List<CaseComment> NewComment = new List<CaseComment>();
for(case c:trigger.new){
if(c.Case_Summary_Changed__c == 'Yes'){
CaseComment com = new CaseComment();
com.ParentId = c.id;
com.IsPublished=FALSE;
com.CommentBody= c.Case_Status_Updates__c;
NewComment.add(com) ;
}
}
Insert NewComment;
}
Regards
Deepak
You can try to make sure email address exists before adding your comment through trigger, or contact E2CP to help resolve this issue.
Regards
Deepak