Update the Case Status Through Email-to-Case Response

Update the Case Status Through Email-to-Case Response

Last Updated on April 2, 2022 by Rakesh Gupta

Big Idea or Enduring Question:

  • How can you automatically update the case status when receives a response from customers via Email-to-Case?

Objectives:

This blog post will help us to understand the following

  • Understand how email-to-case works 
  • Create a flow that fires on the customer’s response to an email-to-case 
  • Use decision element to validate the data
  • Use the update records element to open a closed case

Business Use Case

Pamela Kline is working as a System administrator at Universal Containers (UC). She has just implemented an email-to-case process. Now she has received the following enhancements from the support agent:

  1. Automatically add customer response to the case email thread, when the customer replies to the email that has been sent from a case.
  2. Re-open a case when the customer responds to a support agent email, within five days of case closure.

Automation Champion Approach (I-do):

Email-to-Case allows you to create a case automatically when a customer emails in. It also populates some key information, for example, the email subject becomes the case subject, and the email body-mapped to the description. You can configure multiple Email-to-Case channels based on your business use case.

Next, you have to understand the Thread ID. The thread ID is a unique ID generated for outbound emails within the case. The thread ID will look like ref:_00D90wAtk._500901Kc5WN:re. To automatically add customer responses to the case email thread,  make sure that Email-to-Case has been configured correctly for customer email responses to be attached to the case.

  • Email Threading is an important part of the Email-to-Case setup. Setting this up essentially means that, if a customer emails you more information about an existing Case, their second email will be attached to their existing Case instead of creating a new Case. If you want to auto add a unique Thread ID into your auto-responses and other outgoing emails, then navigate to Setup | Feature Settings | Service | Email-to-Case and select the check-boxes as shown in the following screenshot

Insert Thread ID in the Email Subject and Body

  • When you are replying to a customer make sure to change the address from the Owner to the Email to the Case support address.  If this is not changed, then the response from the customer will be sent to the owner of the case and will not be added to the Email Thread. Follow the below steps to add Email-to-Case support address to from address (Basically we are going to add Email-to-Case support address to Organization-Wide Addresses:
  1. Copy the Email Services Address (i.e. Long email address) from Email-to-Case as shown in the preceding screenshot.
  2. The next step is to add a new Organization-Wide Email Addresses. Use Email Services Address (Long address) in place of  Email Address, as shown in the following screenshot:Organization-Wide Email Addresses
  3. For verification purposes, Salesforce will send an email notification with a confirmation link to the above-mentioned email address
  4. As we are using an Email-to-Case routing address, it will automatically create a case in your org, from where you can verify the ownership of the email address.Verify your Salesforce Organization-Wide Address
  5. Click on the link mentioned under the description to verify the Organization-Wide Address. After successful verification, you can use the Email-to-Case Support address to send out an email from Salesforce.

Email to Case support address

Sample Output

Email Thread

Solution for Use Case – 2

Our next task is to create a Flow on the Email Message to execute, only when an email message is received and re-open a case when the customer responds to a support agent email, within five days of case closure.

To solve this requirement, we will use the After-save Record-Triggered Flow. Check out this article to understand why we are using after-save record-triggered flow for this scenario.

Let’s take a pause here, familiarize yourself with the EmailMessage objects in Salesforce. 

Before discussing the solution, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes going through the following Flow diagram and understand it. Let’s begin building this automation process.

Guided Practice (We-do):

There are 4 steps to solve Pamela’s business requirement using Record-Triggered Flow. We must:

  1. Define flow properties for record-triggered flow
  2. Formula to calculate the number of days between the close date and today 
  3. Add a decision element to check the case status and number of days formula 
  4. Add an update records element to re-open a case

Step 1: Define Flow Properties

  1. Click Setup.
  2. In the Quick Find box, type Flows.
  3. Select Flows then click on the New Flow.
  4. Select the Record-Triggered Flow option, click on Create and configure the flow as follows:
    1. Object: EmailMessage
    2. Trigger the Flow When: A record is created
    3. Set Entry Criteria
      1. Condition Requirements: None
    4. Optimize the Flow For Action and Related Records
  5. Click Done.

Step 2: Formula to Calculate the Number of Days Between Close Date and Today

  1. Under Toolbox, select Manager, then click New Resource to calculate the number of days between case close date and today. 
  2. Input the following information:
    1. Resource Type: Formula
    2. API Name: forN_DaysSinceCaseClosed
    3. Data Type: Number
    4. Decimal Places: 0
    5. Formula: DATEVALUE({!$Record.Parent.ClosedDate}) – {!$Flow.CurrentDate}
  3. Click Done.

Step 3: Using Decision Element to Check Case Status and Number of Days Formula

Now we will use the Decision element to check the case status and the number of days formula. 

  1. On Flow Designer, click on the +icon and select the Decision element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Under Outcome Details, enter the Label the API Name will auto-populate.
  4. Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
    1. Row 1:
      1. Resource: {!$Record.Parent.Status}
      2. Operator: Equals
      3. Value: Closed
    2. Add Condition
    3. Row 2
      1. Resource: {!$Record.Incoming}
      2. Operator: Equals
      3. Value: {!$GlobalConstant.True}
    4. Add Condition
    5. Row 3
      1. Resource: {!forN_DaysSinceCaseClosed}
      2. Operator: Less Than or Equal
      3. Value: 5
  5. Click Done.

Step 4: Add Action – Update Records

The next step is to update the case status to re-open. We will use the Update Records element. 

  1. On Flow Designer, below the Recently Closed Cases node, click on the +icon and select the Update Records element.
  2. Enter a name in the Label field; the API Name will auto-populate.
  3. Click Specify conditions to identify records, and set fields individually
  4. Object: Case
  5. Select All Conditions Are Met (AND)
  6. Set Filter Conditions
    1. Row 1:
      1. Field: Id
      2. Operator: Equals
      3. Value: {!$Record.ParentId}
  7. Set Field Values for the Case Records
    1. Row 1:
      1. Field: Status
      2. Value: Working
  8. Click Done.

In the end, Pamela’s Flow will look like the following screenshot:

Once everything looks good, perform the steps below: 

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. API Version for Running the Flow: 54
  5. Interview Label: Reopen Closed Case {!$Flow.CurrentDateTime}
  6. Click Save

Almost there! Once everything looks good, click the Activate button.  

Formative Assessment:

I want to hear from you!

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

16 thoughts on “Update the Case Status Through Email-to-Case Response

  1. Thanks so much for this. I did not even realize there was an object called email message. I was able to implement this base flow with tweaks to address a pain point within a company’s process. Thanks again.

  2. Any suggestions so that when users originally CC’d on a case reply to a case a new Case does not get created? There does not seem to be a way to setup auto-response to also go to users that are CC’d so that they also get the thread id in the reply.

    1. Actually – I guess I now see the “Case Auto-Response Rules” settings. (I only find answers to problems right after posting.. even if after searching for long periods. ha) Will test to confirm…

  3. I am trying to follow the process builder steps but I don’t have [EmailMessage].Parent.Status and I need to indicate in the criteria that the case has to be closed to start the process. Is there another way to proceed?
    Thank you, the article is very clear and easy to follow 🙂

  4. This is a great use case! Is there a way to test this out in a Sandbox I wonder? I don’t know of a way to turn on temporary email delivery within the sandbox. Any suggestions would be appreciated.

    *Bailey Rudd * Sales Operations | CRM Administrator

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.