How to fetch email from user sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 03:44 AM
I have a updated by field on intake form which is of type string,which is holding userid's. I have to fetch the email of that user'id. How can i do that? Does anyone have idea? Tried below script but not working.
var usr = new GlideRecord('sys_user');
usr.addEncodedquery('user_name=', +current.sys_updated_by);
usr.query();
if (usr.next()) {
gs.eventQueue('get_submitter_email', current, usr.name);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 03:57 AM - edited 07-03-2023 03:58 AM
Hi Hareesha,
Follow the below syntax.
gs.eventQueue('event.name', GlideRecord, parm1, parm2);
you can pass the email into parm1 or parm2 and don't forget to mention in the notification.
gs.eventQueue('get_submitter_email', current, usr.name, usr.email); // I am passing the email id the parm2.
Please mark this as helpful/Correct
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 04:01 AM
Hi Hareesha,
May I know from where you are triggering the event, for eg. Business Rule/Schedule job. Based on this I can simplify your code.
Thanks!!
Ramkumar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2023 04:04 AM
Hi RamKumar,
I wrote above code in business rule and calling the event