---
schema_version: "1"
id: de6f49e7bcfd6fd4b81394bb95c4d2542d09acb141ad1db7b5e10ed053e9d8c4
title: ConnectApi.CommentInput
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_connectapi_input_comment.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_comment.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 62d5e500dadb0a2fe7147ab87656ce75f24421dd46836734609f28ae8c2bc85e
description: Comment input used to add rich comments, for example, comments that include mentions or file attachments.
---
# ConnectApi.CommentInput

Comment input used to add rich comments, for example, comments that include mentions or file attachments.

<table class="featureTable sort_table" summary="">





          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader vertical-align-top " id="d604220e50">Property</th>

              <th class="featureTableHeader vertical-align-top " id="d604220e53">Type</th>

              <th class="featureTableHeader vertical-align-top " id="d604220e56">Description</th>

              <th class="featureTableHeader  " id="d604220e59">Required or Optional</th>

              <th class="featureTableHeader vertical-align-top " id="d604220e62">Available Version</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d604220e50" data-title="Property"><samp class="codeph apex_code">attachment</samp></td>

              <td class="entry" headers="d604220e53" data-title="Type"><samp class="codeph apex_code"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_FeedItemAtt.htm" title="Used to attach a file to a feed item.">ConnectApi.​FeedItem​AttachmentInput</a></samp></td>

              <td class="entry" headers="d604220e56" data-title="Description">Specifies an attachment for the comment. Valid values are: <ul class="ul bulletList">
                  <li class="li"><samp class="codeph apex_code">ContentAttachmentInput</samp></li>

                  <li class="li"><samp class="codeph apex_code">NewFileAttachmentInput</samp></li>

                </ul>
                <samp class="codeph apex_code">LinkAttachmentInput</samp> is not permitted for
                comments. <strong class="ph b">Important:</strong> As of version 32.0, use the <samp class="codeph apex_code">capabilities</samp> property.
              </td>

              <td class="entry" headers="d604220e59" data-title="Required or Optional">Optional</td>

              <td class="entry" headers="d604220e62" data-title="Available Version">28.0–31.0</td>

            </tr>

            <tr>
              <td class="entry" headers="d604220e50" data-title="Property"><samp class="codeph apex_code">body</samp></td>

              <td class="entry" headers="d604220e53" data-title="Type"><samp class="codeph apex_code"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_msgBody.htm" title="Add rich messages to feed items and comments.">ConnectApi.​MessageBody​Input</a></samp></td>

              <td class="entry" headers="d604220e56" data-title="Description">Description of message body. The body can contain up to 10,000 characters and 25 mentions. Because the character limit can change, clients should make a <samp class="codeph nolang">describeSObjects()</samp> call on the FeedItem or FeedComment object and look at the length of the <span class="keyword parmname">Body</span> or <span class="keyword parmname">CommentBody</span> field to determine the maximum number of allowed characters.<p class="p">To edit this property in a comment, use <samp class="codeph apex_code"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterFeeds_static_methods.htm#apex_ConnectAPI_ChatterFeeds_updateComment" title="Edit a comment.">updateComment(communityId, commentId, comment)</a></samp>. Editing comments is supported in version
                  34.0 and later.</p>
                <p class="p">Rich text and inline images are supported in comment bodies in version 35.0 and later. Inline images in content bodies must use content document (069) image files previously uploaded to Salesforce. Entity links are supported in version 43.0 and later.</p>
              </td>

              <td class="entry" headers="d604220e59" data-title="Required or Optional">Required</td>

              <td class="entry" headers="d604220e62" data-title="Available Version">28.0</td>

            </tr>

            <tr>
              <td class="entry" headers="d604220e50" data-title="Property"><samp class="codeph apex_code">capabilities</samp></td>

              <td class="entry" headers="d604220e53" data-title="Type"><samp class="codeph apex_code"><a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_comment_capability_set.htm" title="A container for all capabilities that can be included with a comment.">ConnectApi.​CommentCapability​Input</a></samp></td>

              <td class="entry" headers="d604220e56" data-title="Description">Specifies any capabilities for the comment, such as a file attachment.</td>

              <td class="entry" headers="d604220e59" data-title="Required or Optional">Optional</td>

              <td class="entry" headers="d604220e62" data-title="Available Version">32.0</td>

            </tr>

            <tr>
              <td class="entry" headers="d604220e50" data-title="Property"><samp class="codeph apex_code">threadParentId</samp></td>

              <td class="entry" headers="d604220e53" data-title="Type">String</td>

              <td class="entry" headers="d604220e56" data-title="Description"><span class="ph" id="threadParentId"><a name="threadParentId"><!-- --></a>ID of the parent comment for a threaded comment.</span></td>

              <td class="entry" headers="d604220e59" data-title="Required or Optional">Optional</td>

              <td class="entry" headers="d604220e62" data-title="Available Version">44.0</td>

            </tr>

          </tbody>

        </table>

#### See Also

- [Post a Comment with a Mention](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_post_comment_feed_element_2.htm "Post a Comment with a Mention - HTML (New Window)")
- [Post a Comment with a New File](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_post_comment_feed_element_3.htm "Post a Comment with a New File - HTML (New Window)")
- [Post a Comment with an Existing File](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_post_comment_feed_element_4.htm "Post a Comment with an Existing File - HTML (New Window)")
- [Post a Rich-Text Comment with Inline Image](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_post_comment_richtext_inlineimage.htm "Post a Rich-Text Comment with Inline Image - HTML (New Window)")
- [Post a Rich-Text Feed Comment with a Code Block](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_post_comment_richtext_code_snippet.htm "Post a Rich-Text Feed Comment with a Code Block - HTML (New Window)")
- [Edit a Comment](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/connectapi_examples_edit_comment.htm "Edit a Comment - HTML (New Window)")
- [postCommentToFeedElement(communityId, feedElementId, comment, feedElementFileUpload)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_ChatterFeeds_static_methods.htm#apex_ConnectAPI_ChatterFeeds_postCommentToFeedElement_2 "Post a rich-text comment to a feed element. Use this method to include mentions and to attach a file.")