You need to sign in to do that
Don't have an account?
Tracey
Compile Error: Invalid field CommentBody for SObject Case
Could someboby please let me know why I'm getting this error?
Error: Compile Error: Invalid field CommentBody for SObject Case at line 8 column 23 trigger
UpdateCaseCom on Task (after insert)
{
String LastCaseComment;
Datetime DateFilter = Datetime.now().addSeconds(30);
for (Case dc : [Select id, CommentBody, CreatedDate from CaseComment where CreatedDate >: DateFilter])
{
LastCaseComment = dc.CommentBody;
}
r insert) { String LastCaseComment; Datetime DateFilter = Datetime.now().addSeconds(30); for (Case dc : [Select id, CommentBody, CreatedDate from CaseComment where CreatedDate >: DateFilter]) { LastCaseComment = dc.CommentBody; }
I think there is problem with your SOQL query, return type. You are querying CaseComment object and assigning it to Case object which is not allowed.
Try something like following, and i think it would work.
for (CaseComment dc : [Select id, CommentBody, CreatedDate from CaseComment where CreatedDate >: DateFilter]) {
LastCaseComment = dc.CommentBody;
}
Cheers,
V.R.
Sorry, I meant that I'm not using the Case object. I'm only using the CaseComment object at this point
This works