Primary Email Mismatch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 08:28 PM
Hello!
It has been discovered that there is an email address mismatch between sys_user email and cmn_notif_device email_address for some of our users.
If we manually update an email address within the sys_user table, the business rule 'Update Email Devices' runs perfectly to update the cmn_notif_device email_address field.
We have found the below post from quite a few years ago, that is very similar to what we are experiencing but their script doesn't solve our problem as email_address from cmn_notif_device is not empty.
Solved: Re: Update email addresses for all users - ServiceNow Community
Unfortunately scripting is not part of our skill set (it's on the to-do list)...
Hoping someone will be able to assist with a script or a workaround to get cmn_notif_device to match sys-user email addresses.
And sorry if I post this on the wrong board...
- Liam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 09:21 PM
Hi LiamO, check this code.
var current = new GlideRecord("cmn_notif_device");
current.addEncodedQuery('email_addressNSAMEASuser.email'); // add your query for mismatch list, unless it will run all records;
current.setLimit(20); // limit 20 for testing, remove if you dont need that
current.query();
while(current.next()){
if(current.user && current.user.email){
var userEmail = current.user.email;
current.setValue('email_address', userEmail);
current.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2025 09:40 PM
you can use the same script in background script or I will suggest to use fix script
what did you start with and where are you stuck?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader