- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2015 06:28 AM
Hi,
I have an issue that, when an email is sent using the email client, the 'sys_updated_on' field is not updated with the date/time of the update. The activity is updated with the correct date/time, but this is not reflected in 'sys_updated_on' - i.e. the Updated field.
When updating using Additional comments or just updating Work notes for someone on the Work notes list, the 'sys_updated_on' captures all these updates correctly. They're reflected in both Activity and 'Updated' field.
Any ideas?
Thank you.
NB: I tested this with Incident, Change and Problem.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2015 08:28 AM
Though I could not get the above business rule to work I was able to combine it with another business rule that I found and got it to work.
Table: Email [sys_email]
When = After
Insert and Update Checked
Condition:
current.type == 'sent' && current.headers.indexOf('X-ServiceNow-Source: EmailClient') > -1
Script:
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
var record = new GlideRecord(current.target_table);
//Grab the email message that matches the record
record.addQuery('sys_id', current.instance);
record.query();
if (record.next()) {
record.sys_updated_on = gs.getNowDateTime();
record.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2015 01:58 AM
Hi Jack,
The business rule that Anthony provided works.
Thank you, Anthony.
Regards,
Pelo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2015 08:28 AM
Though I could not get the above business rule to work I was able to combine it with another business rule that I found and got it to work.
Table: Email [sys_email]
When = After
Insert and Update Checked
Condition:
current.type == 'sent' && current.headers.indexOf('X-ServiceNow-Source: EmailClient') > -1
Script:
function onAfter(current, previous) {
//This function will be automatically called when this rule is processed.
var record = new GlideRecord(current.target_table);
//Grab the email message that matches the record
record.addQuery('sys_id', current.instance);
record.query();
if (record.next()) {
record.sys_updated_on = gs.getNowDateTime();
record.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2015 02:00 AM
Hi Anthony,
Thank you for this - works perfectly.
Regards,
Pelo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2017 11:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 06:09 AM
Yes, this was all I had to do. Make sure Insert and Update are checked.