In the event of multiple brands on the same salesforce implementation, there are multiple support email addresses, which implement email-to-case, however in order to properly route the case to the right agent, you need to know the delivery address that the case was originally emailed to. How do you achieve this?

For example, [email protected], [email protected], [email protected] -- a user sends an email to [email protected] -- our routing for cases needs to be able to extract that this was sent to [email protected] so it can be routed to site a agents.

2 Answers 2


The only way you can do this with the existing email-to-case is by grabbing the related social post/email from SourceId when checking the emails in to/cc against your list. Otherwise, your only choice is to write your own Email Service example below:

global class myHandler implements Messaging.InboundEmailHandler {
      global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
          Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
          return result;

I managed to use a record-triggered flow to locate the routing email address

Please follow the steps below:

  1. Create a record trigger flow
  2. In the start object = Email Message, Trigger = Created or Updated, Condition = ParentId is null = false
  3. The parentId will give you the case Id and since you're accessing the email message you can retrieve the routing email address.
  4. I then used an update record element to add the to address to a field on the case record

Hope this helps anyone else that's facing the same issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .