To update the Case Object fields based on Email messages sent or received, users will need to create two Flows for the two fields as instructed below.
Salesforce Classic: Setup | Customize | Cases | Fields
Lightning Experience: Gear icon | Setup | Object Manager | Case | Fields & Relationships
For an Email Message Sent From the Case Record:
1. Salesforce Classic: Setup | Create | Workflow & Approvals | Flows | Continue | New Flow
Lightning Experience: Setup | Process Automation | Flows | Continue | New Flow
2. Click on New Flow → Start From Scratch
3. Select Type → Record Triggered Flow
4. Configure Start → Choose Email Message as Object
→ Trigger the Flow When: A record is created or updated
→ Set Entry Conditions: Email Message Status - EQUALS - Sent
→ Optimize the Flow for: Actions and Related Records
5. Click on Add element (+ icon )
6. Select Update Records element
7. Configure the Update Records element:
→ Fill out the Label and Description as per your requirement
→ How to Find Records to Update and Set Their Values: Update records related to the email message record that triggered the Flow
→ Select Related Records: Triggering Email Message > Case ID ( which should Look Like {!$Record.Parent})
→ Set Filter Conditions: NONE
→ Set field values for the case records: Select the custom field you have created (Case: Number of Messages Sent), and in the Value section, select New Resource.
8. Select Resource Type as Formula
→ Fill in the API name and Description
→ Select Data Type as Number
→ Use this formula:IF(ISBLANK({!$Record.Parent.Number_of_Messages_Sent__c}),1,$Record.Parent.Number_of_Messages_Sent__c+1)
→ Click on Done
9. Select the Formula as the Value
10. Save the Flow and Activate it
For an Email Message Received (Reply from Customer):
1. Salesforce Classic: Setup | Create | Workflow & Approvals | Flows | Continue | New Flow
Lightning Experience: Setup | Process Automation | Flows | Continue | New Flow
IF(ISBLANK({!$Record.Parent.Number_of_Messages_Received__c}),1,$Record.Parent.Number_of_Messages_Received__c+1)→ Click on Done000386661

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.