Incident Activity Email Script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2024 02:21 AM
Good morning,
I need the activity of the incidents (attached images, comments, etc.) to be reflected in the email templates.
I have created an email script to call it later in the email template and be able to add everything, but it doesn't work for me. I am attaching the script.
(function runScript(current) {
var sysId = current.sys_id;
var attachments = [];
var comments = [];
var grAttachments = new GlideRecord('sys_attachment');
grAttachments.addQuery('table_sys_id', sysId);
grAttachments.query();
while (grAttachments.next()) {
attachments.push({
name: grAttachments.file_name.toString(),
size: grAttachments.size_bytes.toString(),
url: GlideServletURL.getApplicationURL() + '/sys_attachment.do?sys_id=' + grAttachments.sys_id.toString()
});
}
var grComments = new GlideRecord('sys_journal_field');
grComments.addQuery('element_id', sysId);
grComments.query();
while (grComments.next()) {
comments.push({
user: grComments.sys_created_by.toString(),
comment: grComments.value.toString(),
created: grComments.sys_created_on.toString()
});
}
return {
attachments: attachments,
comments: comments
};
})(current);
Any ideas? Thank you very much in advance and best regards.
Labels:
- Labels:
-
Architect
0 REPLIES 0