How to add attachement in the notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2023 11:17 PM
Hi All,
i have created a email script which triggers the email with difference in the email address in user table and AD user table , so am getting the result in the notification email , but i need these details in the excel format, how can i get these details in the excel format in the notification.
this is the email script
var mism = []; // Define the array to store mismatched employee numbers
var userGr = new GlideRecord('sys_user');
userGr.addEncodedQuery('active=true^u_account_typeINemployee,contractor');
userGr.query();
while (userGr.next()) {
if (userGr.u_number) {
var adAccountGr = new GlideRecord('u_ad_user_account');
adAccountGr.addEncodedQuery('u_active=true^u_employeenumberISNOTEMPTY');
adAccountGr.addQuery('u_employeenumber', userGr.u_number);
adAccountGr.query();
var emailMismatch = false; // Initialize emailMismatch to false
while (adAccountGr.next()) {
var userPrefix = userGr.email.getDisplayValue().split('@')[0];
var adPrefix = adAccountGr.u_mail.getDisplayValue().split('@')[0];
// Check for email mismatches
if (!(adAccountGr.u_mail.contains("vyx.com") || adAccountGr.u_mail.contains("abc.com"))||(userPrefix!==adPrefix))
{
emailMismatch = true;
break; // Exit the loop if a mismatch is found for this user
}
}
if (emailMismatch) {
mism.push(userGr.u_number.toString());
}
}
}
if (mism.length > 0) {
template.print("The Employee numbers of users whose email IDs are mismatched: " + mism.join(', ') + "\n");
}
})(current, template, email, email_action, event);
email notification am getting as below:
but i need these details in the excel format in the email notification.
any suggestion.
thank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2023 11:55 PM
Hello,
Please check the below post and response from the Servicenow employee:-
Please mark my answer as correct based on Impact.