0

Org-wide compliance BCC would partially meet our spec, but would also bombard our contractor with every single outgoing email from our org. They only need to be copied on emails sent by their employees, who have a specific profile.

  • 1
    Why not just create a custom email id (say an email distribution) and send it there? And assign all those who need that email to that distribution? You can only have the email specified in Compliance BCC emails and that if you enable it, you cannot use any values in the BCC field. – Jayant Das Sep 25 '18 at 22:43
  • There is only one address to which the emails need to be forwarded. But, only the emails from users with a specific profile need to be forwarded. What I need is like an inverse email distribution. If it's from one of the emails on a list, forward it to one email. Of course this would be attainable through IT resources, but it'll be a frequently changing list, and we need it to be self-maintaining on the Salesforce side. – Mobot818 Sep 25 '18 at 23:32
  • 1
    As far as I know, you cannot do it the way you want. Once enabled, all emails sent by Salesforce will be marked to BCC email that you have configured. – Jayant Das Sep 26 '18 at 1:37
  • @Mobot818 -- if you could let me know how we can tell whether a user is one of the contractor's employees, I can add some more detail to my answer. – Shane Steinfeld Oct 2 '18 at 17:22
  • @ShaneSteinfeld They're on the same Profile – Mobot818 Oct 3 '18 at 18:14
2
+50

As far as I know, there isn't a way to interact with outgoing email that isn't being generated by Apex to begin with. If there were, it would be easy enough to just add a BCC based on the sending user...but what fun would that be? ;)

What if we think about the problem differently, and, instead of worrying about BCC'ing the contractor, we send the contractor a separate copy of the email? One big advantage to this: You'll never have to worry about the contractor accidentally replying to the email!

The good news is, you can do this all declaratively: Since outgoing emails are saved as completed Tasks, use Process Builder to write a flow that looks at the Task object on creation only. The flow should process records that meet the following criteria:

  • Task.Status = "Completed"
  • Task.Description begins with "From: " [the task owner's email]

This formula should do the trick:

AND([Task].Status = "Completed", 
    BEGINS([Task].Description, "From: " & [Task].Owner:User.Email)
}

Then, in Lightning Flow Designer, create a Flow to determine whether the user who sent the email is one of the contractor's employees. If so, we'll grab the info we need from the User's record (Name, Email address, ...), and create and send the email.

Use the Process Builder described above to launch the Flow.

[UPDATE]

As of the Spring '18 release, outgoing emails are saved as EmailMessage records AND Tasks, as long as you have email-to-case or Enhanced Email turned on. (Enhanced email is enabled for most orgs by default.) The Tasks that are created won't fire the Process Builder flows; only the EmailMessage records will.

*See Workflow on Task does not fire based on email sent from an object

Instead of building your Flow to look at the Task object, have it look at all EmailMessage records where the "Incoming" equals false.

[EmailMessage].Incoming == False.

From there, everything is the same!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.