Email Ingestion with Emails across multiple accounts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi all,
I have a requirement to allow email ingestion into the platform which is fine when the user is only associated to one account.
There is an instance on the platform where a third party service desk manages more than one customer account so there is a contact across those accounts with the same email address. Is there a way around the issue that Service Now just seems to pick one User ID and associates it to the email then the incident will be raised under the wrong company.
So in this case if it turns out there are multiple users with the same email address it raises the incident with no account selected but when the Service Desk agent reviews the email and selects the correct account the email and user id issue then gets resolved?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello @aac31246
If there are email received in your ServiceNow instance, then there has to be something unique to represent the company name because the e-mail abc@xyz.com is associated with many companies in your scenario. If the company name is there in the e-mail body text, then you can create inbound email action or flow accordingly to set the correct account based upon the company value received.
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @aac31246
As you mentioned in your requirement the same email sends to multiple users and the users belong to different companies. When email comes in, ServiceNow can’t decide which user is correct. So it either picks one randomly or fails to map properly then Incident gets created under wrong company.
To resolve this, you can customize the inbound email action to detect duplicate users and avoid auto-assignment. Instead, you can allow the service desk agent to manually select the correct user and company, ensuring data accuracy.
Customizing Inbound Email Action
Step1 : Go to > System Policy > Inbound Actions. Update your Create Incident inbound action.
Step2 : Paste below code in the script section
var fromEmail = email.origemail || email.from;
var userGR = new GlideRecord('sys_user');
userGR.addQuery('email', fromEmail);
userGR.addActiveQuery();
userGR.query();
if (userGR.getRowCount() == 1) {
userGR.next();
current.caller_id = userGR.getUniqueValue();
if (userGR.company) {
current.company = userGR.company;
}
} else {
current.caller_id = '';
current.company = '';
current.work_notes = "Multiple or no users found with sender email: " + fromEmail +
". Service Desk must select the correct caller/account manually.";
}
current.short_description = email.subject;
current.description = email.body_text;
current.insert();
Step3: Finally Agent will fix the issue
When agent opens incident, Caller field will be empty (or generic) and Company field will be empty
then Add UI policy or client script to show message like
“Multiple accounts found for this email. Please select correct caller/company.” the agent will look into it and then fills the correct field accordingly.
Hope this helps. Let me know if you need more details.
