You need to sign in to do that
Don't have an account?

Error: Invalid case comment body
Not able to use case comment object.Initially we write few lines of code on case comment object and it was working. But, now when we are trying to change the code its is showing invalid variable commentbody error message. Then i reverted all the changes and just tried to save the method as earlier. But now also im not able to save that class. Same code is not giving errors in UAT but getting error in Dev sandbox.
public static void UpdateCaseComment(string Id, string comment ){
casecomment cc=new casecomment();
cc.Id=Id;
cc.commentbody=comment;
try{
update cc;
}catch(Exception e){
System.debug('er->'+e);
}
}
This is my code
Please let me know what is causing this issue.
Deleted that class and issue resolved
All Answers
Can you share the error message?
Thanks,
Gaurav
Skype: gaurav62990
@Saikrupa,

I tried and it worked for me. See the above image.
Thanks,
Gaurav
Skype: gaurav62990
@Gaurav
it is working for me in UAT but not in Dev sandbox
check the API Version of class, make it to latest.
The API version is latest only. But still not working
@saikrupa,
Try to insert CaseComment via Anonymous Window. The above screenshot you share seems like CaseComment isn't able to initialize properly. Not only the CommentBody event ID isn't available.
Thanks,
Gaurav
skype: gaurav62990
Deleted that class and issue resolved