Use Case: Use Flow To Auto Close The Spam Case
Spam is like a never-ending fight, especially for marketing and support teams. Of course there are many 3rd party apps that help to detect the spam, but you can also build an easy and lightweight solution using Flow! Today let’s see how to store email addresses into a block list, and auto close the spam case with Flow.
* Big thanks to D. James for sending in the case!
Lulu Mobile use standard Email-To-Case feature as part of their customer support. Sometimes they will find many spam cases sent in by a specific email address, so they want to store these email addresses in a block list. Next time if there is a new case from any of these addresses, they want to automatically mark it as spam and close the case.
The original request is as such:
- Let user click a button to store a web email as a custom metadata type record (Block list)
- Whenever a case is created from a blocked email, the case should be automatically marked as spam and closed
For Flow #1, we will use a Screen Flow and make it an Action. However, We cannot create custom metadata type record in Flow yet. So instead of using a CMDT, we will use a Custom Object called Block Emails.
In Block Emails object, I have only one custom field called Email To Block (Email_To_Block__c).
For Flow #2, we will use a Record-Triggered Flow but fire it on Email Message, instead of Case. The reason is when we are using Email-To-Case, the connection between the Case and the Email Message is established after the triggers for Case finish running. If the flow runs on Case, it won’t be able to find the originated email address. You can see this discussion thread for more information.
Flow #1: Add Email To Block List
Flow #2: Auto Close Cases Sent By Blocked Emails
Screen Flow and Record-Triggered Flow | Get Records | Variable/Collection |
Assignment | Create Records | Record Id |
Decision | Update Records |
Does the solution solve your problem? If not, write us what your problem is and we will build the flow for you!
I’m new to flows, so your site is really helpful to me. I was able to get Flow #2 to work, but Flow #1 still wont work for me. I’m still trying to figure out where I went wrong. However, just to get Flow #2 to work was really helpful. Thanks!
Hi, wayne cecil I faced the same problem while creating the first flow. We are passing wrong id to screen flow. We need a simple text type id to store the case id. So we have to get an element to get case based on record id. Then we have to follow the same step which is mentioned in the guide. I am going to attach all the images which will be helpful for you.
Here is the record id.
This is the first flow I am creating. I am stuck at step 7 at New Get Records where the Object is Block Email. When I enter Block Email and click on Done, I get an error message that “A value is required”. How do I get it to accept Block Email?