- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2015 02:42 AM
Hi All,
We have an issue where users are not receiving emails from ServiceNow because their email (on sys_user table) has been updated but this update has not been reflected under their primary email address (which is used for sending email notifications). Therefore, emails are being sent to the old email address The issue occurs when user email gets updated on user record but it does not get reflected on their primary email. We are not not sure how many users are not receiving their emails because their primary email and the one on their user record do not match.
1) Did anyone encounted this type of problem previously and have any suggestions on how to resolve it? We also logged HI ticket for this.
2) Does anyone know where the primary email lives (on which table)? We want to run reports that would show all users whose primary email is different from the one on their user record (we tried to create one but we cannot locate the table on which the primary email information lives).
Any thoughts and suggestions are appreciated!
Kind Regards,
Kamile
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2015 04:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2015 06:23 AM
Hi Kamile,
I tried reproducing the given scenario (1) but I cannot. Whenever a new sys_user record is created / updated below OOB business rules execute:
Create primary email device
Update Email Devices
And, these scripts keep the data in sync in table cmn_notif_device. Have you tried reproducing it in your instance? Or else, I would suggest you creating a debug business rule on sys_user table and capture logs. It must help you fixing it.
Brgds, AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 02:23 AM
I tried reprocuding the issue and I can do it on all of our instances. I routed this issue to ServiceNow as something seems to be broken. We never edited the rule and the records show up as updated, yet the rule does not run. Thank you for your effort! This seems to be impacting just us..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2015 10:35 AM
Wow...it seems to be interesting now!!!
If you don't mind, can you please share both of below Business Rule scripts:
Create primary email device
Update Email Devices
Along with the script code, also please let us know when the business rule runs e.g. before/after and insert/update etc.
Would be glad if I can assist you any further
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2015 02:22 AM
Sure - here are both of the business rules:
1. Create primary email device
When to run: after Insert (no additional conditions)
Script:
var thisSysID = current.sys_id;
var device = new GlideRecord('cmn_notif_device');
device.user = thisSysID;
device.email_address = current.email;
device.primary_email = true;
device.active = true;
device.type = 'Email';
device.name = 'Primary email';
device.insert();
gs.addInfoMessage(gs.getMessage('Primary email device created for') + ' ' + GlideStringUtil.escapeHTML(current.name));
2. Update Email Devices
When to run: after Update
Condition: current.email.changes() || current.notification.changes()
Script:
var thisSysID = current.sys_id;
var device = new GlideRecord('cmn_notif_device');
device.addQuery('user', thisSysID);
device.addQuery('type', 'Email');
device.query();
while (device.next()) {
if (device.primary_email == true)
device.email_address = current.email;
if (current.notification.changes()) {
if (current.notification == 2)
device.active = true;
else
device.active = false;
}
gs.log('Updating ' + current.name + 's email devices based on change to user record email address or Notification field');
device.setWorkflow(false);
device.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2015 12:59 PM
Kamili,
I have reviewed both the scripts and they are fine. Difficult to make any guess further without looking into the instance but, I have one more suggestion perhaps it can help you.
Have you tried using System Diagnostics e.g. debug business rules etc.? May be it can get you any further clue otherwise wait for HI support feedback.
Please let us know when you come up with any findings...
Brgds, AM