- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 08:24 AM
Hello everyone,
I m pretty new in this scripting world so take it easy 🙂
I need to find a way to log emails (internal and external) that are being sent from/to ServiceNow in the request activity log.
I found some posts from like 3-4 years ago but I couldn't make it work
thank you
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 08:46 AM
Hi,
Not 100% sure what you mean as they are already logged in the activity log...
Perhaps you don't have them set to show?
But if you go here in a record for example:
You'd pick the field(s) you want to show in the log. If it doesn't appear initially, then click that "Configure available fields" and slide the "Sent/Received Emails" selection to the right column and save.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 05:27 AM
Hello,
Then those emails that are being sent for reminder approval aren't associated to this specific record. Reminders aren't OOB, so...you'd need to show what your script is in regard to sending those reminder emails. If the email is associated to this specific record, then it will show in the activity log if you have "Sent/Received Emails" as a visible option.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 06:28 AM
This is our script :
remindApprovers();
function remindApprovers(){
// remind everyone, all the time?
var spamMachine = false;
var appr = new GlideRecord('sysapproval_approver');
if (spamMachine){
appr.addQuery('state', 'requested');
}
else {
appr.addEncodedQuery('state=requested^sys_updated_onRELATIVELT@hour@ago@24');
}
appr.query();
while (appr.next()){
gs.eventQueue("approval.inserted", appr, gs.getUserID(), gs.getUserName());
gs.log('Re-requested approval of task ' + appr.sysapproval.number + " by " + appr.approver.name);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 07:01 AM
Also we also need to log in emails that are being sent on demand from a custom template, not OOB
We added a step to send email manually from the workflow and we need to log that also

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2020 07:56 AM
I see.
So the difference, initially, that I see is that you're using the same approval event to send the notification again, curious if that's not tracking things appropriately. We too do reminder notifications, but I've developed the solution to fire a new event, that triggers a different/custom notification. On the sysapproval_approver table, for example, that has verbiage about it being a reminder, etc.
If you develop this same solution for the onDemand feature, they should post appropriately.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2020 03:47 AM
hello everyone
thank you for yout help