You need to sign in to do that
Don't have an account?
Nish321
Issue with trigger to Insert CaseComment when a case is created
Hi, It is throwing an error "Error: Compile Error: Variable does not exist: com.ParentId at line 9 column 7".
Could someone please help me what's wrong here?
trigger CaseCommentsUpdate on Case (after insert, after update) {
List<CaseComment> NewComment = new List<CaseComment>();
for(Case ca: Trigger.new){
if(ca.Next_Contact_Date__c <= Today() && ca.status = 'Client Action Required' )
CaseComment com = new CaseComment();
com.ParentId = ca.id;
com.CommentBody= ca.description;
NewComment.add(com) ;
}}
Could someone please help me what's wrong here?
trigger CaseCommentsUpdate on Case (after insert, after update) {
List<CaseComment> NewComment = new List<CaseComment>();
for(Case ca: Trigger.new){
if(ca.Next_Contact_Date__c <= Today() && ca.status = 'Client Action Required' )
CaseComment com = new CaseComment();
com.ParentId = ca.id;
com.CommentBody= ca.description;
NewComment.add(com) ;
}}
You will have to wrap if condition code within curly braces.
for(Case ca: Trigger.new){
if(ca.Next_Contact_Date__c <= Today() && ca.status = 'Client Action Required' ){
CaseComment com = new CaseComment();
com.ParentId = ca.id;
com.CommentBody= ca.description;
NewComment.add(com) ;
}}}
Use the below code it will work,
Thanks,
Vijay