- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-24-2022 04:31 AM
I want technicians to be able to append email notifications with a personalised signature. I have created a field on the user form called 'Email signature' which they can update. I intend to write an email script that will be included in an email layout so that all notifications using the template\layout with pull in the user's signature. However, how do I identify is generating the email, i.e., who the event creator is? Is it the current user? If so, why doesn't this mail script work?
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var user = gs.getUser();
if (user.u_enable_email_signature == true) {
template.print(user.u_email_signature);
}
})(current, template, email, email_action, event);
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-24-2022 04:44 AM
You can try
event.user_id
and
event.user_name
to get the user id and user name from the event. Then you can just use GR to get the information you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-24-2022 04:44 AM
You can try
event.user_id
and
event.user_name
to get the user id and user name from the event. Then you can just use GR to get the information you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-24-2022 04:46 AM
Basically you should be able to check any value that the event has in the sysevent table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-24-2022 05:18 AM
Thanks!
This is the code I used in the end:
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var userGr = new GlideRecord('sys_user');
userGr.get(event.user_id);
if (userGr.u_enable_email_signature == true) {
template.print(userGr.u_email_signature.replace(/\n/g, "<br>"));
}
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā01-24-2022 04:48 AM