Case Comment Error

I am building a LWC that displays Case Comments and also allow users to create new Case Comments. I am having a lot of issues with isPublished on record insert. For some reason it is giving me the error above. I can save a CaseComment if the object i am passing to apex doesn't have the isPublished field included (the field is tied to a checkbox so if users don't select it, it isn't in the object passed to Apex)

However i can run anonymous apex and it inserts a CaseComment record without issue.

insert new CaseComment(ParentId = '50002000000Ub7OAAS', CommentBody = 'the second time', isPublished = true);

I am the system admin and have all privileges on Case, though I shouldn't need to for this field per the CaseComment api documentation

Any thoughts on what is causing this error?

  • 1
    That is odd. Do you get an error if you include the field (with true/false values)? – sfdcfox Jul 29 '20 at 21:58
  • @Bobbygllh Double check if you have edit and create access on cases. If you do not find anything I suggest you raise a case with support to see what's going on under the hood. – Mohith Shrivastava Jul 30 '20 at 0:07
  • @sfdcfox yes, if i include the field with true / false values, it gives me the error in the screenshot in my original post. I put the anonymous apex snippet in my apex class (ie. just hard coded it) and it submitted the CaseComment without issue so its not a permissions thing – Bobbygllh Jul 30 '20 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.