Fetch email address from Compose Email page and Validate with User ID field on sys_user table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi,
I have a requirement to validate the email addresses we put on the compose email page from HR cases. Once the agent sends email, I want to fetch the email addresses and validate them with the User ID field on the sys_user table as this field contains the correct addresses. I want to send emails only if the data matches with User ID field, else abort sending. We can allow partial sending of emails for correct addresses.
Thanks,
Rahul
@ankurbawisk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
but why to validate it?
If they select the user then it means that user is present in sys_user and should have correct email address.
You should ensure your sys_user table is accurate and that's it.
The OOTB script include already fetches the email from sys_user
💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Ankur,
Actually we have some vendor/group/store email addresses on the email field on user profiles. When we put user names on the compose email page, by default if picks the addresses available on the Email field of that profile. The User ID field of the user profile contains the correct email addresses which is why we want to put this validation.
Since data correction is a big task, it will be planned in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
so you have vendor/group/store email addresses stored on sys_user USER ID field?
If yes then not a good idea.
In that case you can use before insert business rule on sys_email table and check for your subject and then remove the unwanted recipients from the To field
-> query sys_user with these emails
-> see which user records to remove
-> remove it from this string field and set that field again
💡 If my response helped, please mark it as correct ✔️ and close the thread 🔒 — this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
54m ago - last edited 53m ago
Yes I was also thinking same to put a BR on the sys_email table. But will it not impact the instance performance? I mean currently we are targeting HR table, but if more tables require same functionality then would this be recommended?
Is it possible to put some validation on the Compose email Page itself?