How to change domain for email inbound action

gavinteo
Kilo Contributor

Hi All,

I am creating a new email inbound action to create incidents from email.

I understand that the domain is set when the caller id is set at this juncture --> current.caller_id = gs.getUserID();

However, this retrieved the first user record based on the user sending the email in and the domain gets set to the wrong value.

As i am using a domain separated environment, i would need to have different email inbound action to differentiate by the different email mailbox.

A user will also have multiple user accounts in the system, and based on the email mailbox they include in the email, i will need to set the company and domain value of the incident accordingly and also tie to the correct user account to the incident.

I do not have issue setting the other fields on the incident table, except the domain value.

I have tried various methods like calling script include from the email inbound action, hardcoding the domain directly from the email inbound action to no avail.

Any other method is there for me to try?

Thanks

7 REPLIES 7

Michael Fry1
Kilo Patron

'A user will also have multiple user accounts in the system' - what's the reasoning for this? If you fix this, the domain will get set correctly.


I'm running into a similar issue. Not for existing users, but for non-existing users who submit calls through email. I am trying to auto provision users who don't yet exist via inbound email with the 'Automatically create users for incoming emails from trusted domains' email property. However it appears that all the new users go to the default domain despite setting their company properly in the inbound action. I even tried updating the sys_domain field directly in a GlideRecord but it doesn't work. I assume this is because the code 'runs as' the new user who does not have access to see other domains. Any other field on the user's record I can set in my inbound action just not the domain. Any ideas?

Hi Chris,

Here's an alternative and untested solution for you:

  1. You can turn off the automatic user creation and let the system create the mail message under your Guest account instead.
  2. Then adjust your Inbound Email Action to include the code for creating the new user as you desire (i.e., create a new GlideRecord on [sys_user] and set the values you want.  Get the original sender's email address from the email message record).

If I find some time later on, I'll set this up and test.  But meanwhile you could give it a go in a Dev environment.

 

Thanks,

-Brian

gavinteo
Kilo Contributor

Hi Michael,



As we are operating on a managed service provider model, there are instances whereby a user can be represented for multiple services and exist in different domains. They are also holding different mobile numbers for service notification purposes. However, they have only a single email account.



This resulted in a user having multiple entries and the email address is not unique.



Anyway we can circumvent this to tie to the correct domain?