Loading

Prevent Case Creation for Bounced or Out-of-Office Emails

Date de publication: Sep 13, 2023
Description

It's possible to control Email-to-Case creation, but it'll require some development knowledge. To help get you started we've provided some sample code on how to prevent case creation from bounced or out-of-office emails.

Résolution

First, make sure you assign a Case Origin specific to Email-to-Case.

With that in place, you can create a trigger on case, for a before insert action. Similar to this, detect Email-to-Case cases about to get inserted, and check/block their progress:

Example code

trigger manageEmailCases on Case (before insert) {

    // go through our new cases and see if any email2case, "process" them
    for(Case thisCase : trigger.new) 
    {
        if(thisCase.Origin == 'Support Email') {
            /* Here's where to do your work
            if(thisCase.Subject.contains('OOO')) {
                thisCase.name.addError('Not saving e2c');
            }
            */
        }
    }

}
 

What you put in the logic depends entirely on organizational requirements. 

Hard coding known origins or subjects is an option, but you also want to be defensive of "swallowing up" cases with a bit of bad logic. Please adjust the logic to account for emails in different languages or variations of Out-of-Office text. It would be more apt to manage their fields, such as autoclose them, or add a "for review" flag instead.

If this is a feature you'd like to see added to Salesforce, vote for this idea on IdeaExchange :  Email-to-Case : Prevent Case Creation for Bounced or Out-of-Office Emails

Numéro d’article de la base de connaissances

000387850

 
Chargement
Salesforce Help | Article