You need to sign in to do that
Don't have an account?
Glen.ax1034
get casecomments from case
I can't figure out why this isn't triggering when i have it run against a case that has comments.
usually i'd expect it to throw an error. but the lack of error shows that it isn't even entering the for loop
for (Case escalatedcase:Trigger.new){ // escalatedcase.addError(escalatedcase.CaseComments); for(CaseComment oldcomment : escalatedcase.CaseComments) { CaseComment newcomment = oldcomment.clone(false, true); //newcomment.ParentId = CaseAdd.Id; ccomments.add(newcomment); escalatedcase.addError('Please choose a Tier 2 Escalation Level to direct escalation.'); //in your face! } }
Data for related records (CaseComments) is not automatically available in a trigger on the parent object (Case). You need to retrieve the related records with a SOQL query in order to work with them in the trigger.
All Answers
Is it a after update /before update trigger on the Case ? and did you check whether the case comment is being captured at this point ?
here
I could give you all of the code but i dont want to start confusing you. there's a lot of code.
here's a screenshot of the case that i am using to debug:
Data for related records (CaseComments) is not automatically available in a trigger on the parent object (Case). You need to retrieve the related records with a SOQL query in order to work with them in the trigger.