What is the purpose of Case Comments in tracking investigation notes and progress?
Answer
Basics: CaseComment is a child of Case with CommentBody (up to 4,000 characters) and IsPublished. Private comments are for agents; published comments appear to customers in Experience Cloud or the Customer Portal.
How it works:
- Add the Case Comments related list to the case page (Lightning) or use Case Feed's posts.
- Agent adds a comment and chooses Make Public if appropriate.
- Public comments are visible to the customer; if "Enable Case Comment Notification to Contact" (Support Settings) is on, the contact is emailed.
- Comments appear in the case history and activity context and can be reported with Cases with Case Comments report types.
Advanced / deep dive: In orgs using Case Feed, agents mostly use feed posts, emails and internal notes instead of comments, which lets them mix Chatter, email and logging. CaseComment supports triggers but not custom fields or attachments; if you need richer notes use Feed items, ContentNote or a custom child object. Permissions: editing and deleting comments is limited by permissions (verify). Comments inherit the case's sharing. Integration: sync public comments to external ticketing tools using CDC or a trigger, and make sure to flag visibility. Automation: Flow can create comments on status changes, but remember record-triggered flows on CaseComment require care with notifications.
Code / config example:
List<CaseComment> notes = new List<CaseComment>();
for (Case c : closedCases) {
notes.add(new CaseComment(ParentId = c.Id,
CommentBody = 'Resolved: see Knowledge article.',
IsPublished = ));
}
insert notes;