Dan Martinez
Tera Expert

Overview

Most of the times emails sent by a user in a domain must stay in the same domain, but there might be cases in which a user submits a ticket that has to switch domains. There are use cases for this, although in this blog post we won't cover them. This blog article is about how to solve such situations with a simple solution that has been proved to be safe. Note that there may be other solutions and that you have to remember to test this solution thoroughly on your instance, since it might have implications depending on other customisations.

 

Understanding the OOB behaviour

One would think that creating a "Business rule" (i.e) that swaps the domain before inserting the email in the "sys_email" table, would work. However, there seems to be a rule (couldn't spot it but the behaviour is there) that will reset its domain to the one it had. Why is this happening? After investigating its behaviour, one reaches the conclusion that the instance will simply set its domain to the domain of the user who sent it, ignoring the one set in the email record.

 

Solution

As you may have already guessed, replacing the original user by another user in the domain you need the email to be routed to, will sort out the issue. Nonetheless, that means you will lose the original sender. Not to let this happen, you can always create a new reference field that keeps the "Original sender" in it.

 

If you liked the solution give a thumbs up and feel free to share alternative solutions you have implemented.