Loading

Create a report to display 'Last Case Comment'

Publiceringsdatum: Jul 6, 2026
Beskrivning

It is possible to Create a Custom Report Type with Cases as the primary object and Case Comments as the secondary object and sort case comments based on their Created Date however, it's not possible to show only the latest case comment in report results.

To include only the last case comment in a report, Build a Flow to populate body of the last case comment into a custom case field in order to add it to your reports.
 
Lösning

This article explains how to display only the most recent Case Comment on a Salesforce report. Because standard Salesforce reports do not support filtering to show only the latest Case Comment, you need to create a custom Case field and a Record-Triggered Flow to populate it automatically. The Flow runs each time a new comment is added and writes the comment body to the custom field, which you can then add to any Case report.

Create a Custom Case Field

  1. Navigate to the Case object in Setup and create a new custom field with the following settings:
    1. Data Type: Text Area (Long)
    2. Field Label: Last Case Comment
    3. Length: 4,000

Note: The CaseComment body field is limited to 4,000 characters.

  1. Select your desired Field Visibility and apply the field to page layouts as needed. See Create Custom Fields  for more information.

Build a Record-Triggered Flow

  1. Select Record-Triggered Flow
  2. Set Object to Case Comment
    1. Trigger the Flow When: A record is created
    2. Optionally, set desired Condition Requirements, or choose None to run the flow each time a comment is added to a Case
    3. Optimize the Flow for: Actions and Related Records
  3. Add an Update Records element to the Flow
    1. Label: Update Last Case Comment
    2. How to Find Records to Update: Update records related to the Case Comment record that triggered the flow
    3. Records Related to Case Comment: Select $Record | Parent (value populates as $Record > Parent ID)
    4. Set Field Values:
      1. Field: Last Case Comment (the custom field created above)
      2. Value: Select $Record | Comment Body (value populates as $Record > Body)
  4. Save your flow, provide a Flow Label, and select Activate. See Build a Flow for more information.

Test your flow by creating a case comment on a sample case and verify that the Last Case Comment field is populated as expected.
Note: The Flow does not retroactively populate the Last Case Comment field for existing cases. Each time a new case comment is added after activating the flow, the field will be updated with the most recent comment.

Add the Last Case Comment Field to Reports

Once the Flow is active and populating the Last Case Comment field, add this field to any desired Case report or report type for display.

Knowledge-artikelnummer

000393878

 
Laddar
Salesforce Help | Article