Loading

How to update Case Status Based on Email Messages on Cases

Publiceringsdatum: Sep 27, 2025
Beskrivning
When using Email-to-Case it can be very helpful for the case status to be automatically updated when an email message is received on the case or when an email is sent from the case

Some businesses processes require only changing the status when emails are received if the existing status is something like Pending Customer Reply
Lösning

Create a flow to handle this automatically. 

The below instructions will fit the needs of common Salesforce orgs, you may need to add some case statuses or deviate from the exact instructions to accommodate your organization’s needs. Additional case status updates can be made and additional case status decision outcomes can be added to fit your needs. Remember to always build and test in a sandbox before moving the flow into a production org. 
image

Create a record-triggered flow on the EmailMessage object.

The entry conditions for the flow listed below will allow emails either sent from the case or emails received on the case from Email-to-Case to meet the entry criteria.


Condition Logic

Note :
For outgoing emails, the entry condition "Status = 3" may not work as expected. The flow does not trigger automatically for outgoing EmailMessage records that meet this condition. However, when the same record is debugged manually, the flow executes correctly. 

(1 AND 4) OR (2 AND 3 AND 4)

Condition.PNG
image

Create a decision element named Email Direction

This element will decide if the email message is coming into Salesforce or was sent from Salesforce. Name the outcome you create Incoming and rename the default outcome to Outgoing.

Note : (Please ensure that the "Incoming" label used in the Email Direction decision element is correctly referencing the EmailMessage (record that triggered the flow) instead of the Email_Direction resource. Using Email_Direction.Incoming may cause the flow to behave incorrectly, as it should be referencing EmailMessage.Incoming for accurate evaluation.)
Incoming
Incoming.PNG
image

Create a decision element on the Incoming side called Current Case Status

Create two outcomes, one will be called Case is New and the other should be called Case is Closed, also rename the default outcome to Other Case Status.


Case is New
CaseIsNew.PNG

Case is Closed
Closed.PNG
image

Update closed cases to reopened

Create an update records to update the case with the Id that matches the flow variable {!$Record.ParentId} with Reopened.
image


Update cases with other statuses to Email Reply Received

Create an update records to update the case with the Id that matches the flow variable {!$Record.ParentId} with Email Reply Received. 
image


Create a decision element on the outgoing side called is the Case Closed or New?

Create an outcome called Closed or New and rename the default outcome to Not Closed or New. The 1st outcome should be set to execute the outcome when Any Condition Is Met (OR).

Closed or New

Closed or New.PNG
image

Update cases that are not Closed or New to  Pending Customer Reply

Create an update records to update the case with the Id that matches the flow variable {!$Record.ParentId} with Pending Customer Reply.
image


Note: As with flow, there are many correct ways to accomplish things that all get to the same outcome. This was written following best practices using the functionality available in flow at the time of writing, as more features come out in flow there may be UI changes causing the images to not match exactly. 

Note: At the time of writing, debugging the flow for email messages does not work. More info is available here.


See also :
Build a Flow
Add and Edit Elements in Auto-Layout

_____________________________________

Written By: Andrew Russo | Salesforce Answers Leader
Andrew Russo is an Archa-Admin-Eloper-Analyst at BACA Systems. He has been in the Salesforce ecosystem since 2017 and has immense platform knowledge. He empowers Trailblazers to become more proficient in their use of Salesforce.

Submissions reflect only the opinions of the user who made available the Submission and not the opinions of Salesforce, regardless of whether the user is affiliated with Salesforce, and may contain or constitute products, services, information, data, content and other materials made available by or on behalf of third parties ("Third Party Materials).  Salesforce neither controls nor endorses, nor is Salesforce responsible for, any Third  Party Materials, including their accuracy, validity, timeliness, completeness, reliability, integrity, quality, legality,  usefulness or safety, or any applicable intellectual property rights. Any Submissions made available through any message board or forum in response to posted questions, or that otherwise purports to answer any questions, including any questions about Salesforce or Programs, are made available for your general knowledge only and should never be relied upon as answers to your specific questions (even if an answer is marked as a “best” answer or with any similar qualifications). You should always contact Salesforce support for answers to your specific questions. Salesforce has no control over Submissions, and is not responsible for any use or misuse (including any distribution) by any third party of Submissions.

If you have questions, tap into the wisdom of our entire Trailblazer Community here: https://trailhead.salesforce.com/trailblazer-community/feed

Knowledge-artikelnummer

000393845

 
Laddar
Salesforce Help | Article