How to change domain for email inbound action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 11:35 PM
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
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 07:49 PM
Most of us using domain sep are MSP's. We change domains all day long, but only have 1 account. Not trying to re-engineer you system, but that doesn't make sense to me, plus you're paying for double licensing for each user with 2 accounts. Seems like that would be a driver to fix this.
No way to circumvent that I know of. All emails come into global, and get domain from first user account it finds. Give them a second email address in the corp email, then update one of the accounts so the email is unique. It's up to them to send email from correct account.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 11:05 PM
Hi Gavin,
I would suggest that you create a business rule on the [sys_email] table to update the user fields on the email message at the time the record gets inserted. Then your inbound actions can proceed normally, assuming you've set the right user already.
In your business rule, create a GlideRecord on [sys_user] and use whatever criteria you need to locate the correct user account. Once you have that in-hand, you take the sys_id of that record and use it to set the value for both the 'user' and 'user_id' fields on the current record being inserted in the [sys_email] table.
ex. BR - [sys_user], run on Insert, Before
var mailboxDomain = (some domain based on which mailbox is found in current.recipients)
var gr = new GlideRecord('sys_user');
gr.addQuery('email', current.user_id.email);
gr.addQuery('domain', mailboxDomain);
gr.query();
if(gr.next()){
current.user_id = gr.sys_id;
current.user = gr.sys_id;
}
This should change the user associated with the email record to whichever is desired BEFORE your IEA's run against the record later on. Give that a try, and double-check the domain field name on the User table, I'm assuming it would be 'domain' but we are not running domain separation, so I have no instance to verify on.
-Brian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2016 11:28 AM
While I'm fairly certain this should work for your scenario to update the user on the email record as needed, I have to agree with Michael. Having multiple accounts per user does not sound like an efficient or easily managed method of separation to provide your different types of services.
You could likely get by using group membership, roles (if needed), some kind of subscription record, or some other identifier to enforce the separation instead.
-Brian