function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SaiKrupa JSaiKrupa J 

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.

Best Answer chosen by SaiKrupa J
SaiKrupa JSaiKrupa J
Actually there is a class with name casecomment which is name of standard class . This is causing issue.
Deleted that class and issue resolved 

All Answers

sandeep zlatosandeep zlato
Thank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC. But do you know about the “Hotmail account recovery” issue? No? This will help you.
 
SaiKrupa JSaiKrupa J
Could nt able to get you sandeep .. please explain in detail
GauravGargGauravGarg
Saikrupa,

Can you share the error message?

Thanks,
Gaurav
Skype: gaurav62990
SaiKrupa JSaiKrupa J
User-added image
GauravGargGauravGarg

@Saikrupa,

User-added image
I tried and it worked for me. See the above image. 
 

Thanks,

Gaurav
Skype: gaurav62990

SaiKrupa JSaiKrupa J

@Gaurav

it is working for me in UAT but not in Dev sandbox 

GauravGargGauravGarg
@saikrupa,

check the API Version of class, make it to latest. 
SaiKrupa JSaiKrupa J
@GauravGarg 
The API version is latest only. But still not working 
GauravGargGauravGarg

@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

SaiKrupa JSaiKrupa J
Actually there is a class with name casecomment which is name of standard class . This is causing issue.
Deleted that class and issue resolved 
This was selected as the best answer
Smith BillSmith Bill
Thank you so much for sharing your information with us. We will be eternally happy with all that you have done here because you have facilitated my work. But are you wary of SBCglobal Email Login (https://sbcglobalemaillogin.com/) Password Recovery issues? No way? This will help you.
 
Naksh vermaNaksh verma
Thank you so much for sharing your information with us https://allaeps.com/