- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2011 08:55 AM
Is there a way to add the Attachment History to the Activity field? We would like a record of all attach/unattach activity for some of our records.
Solved! Go to Solution.
- Labels:
-
Orchestration (ITOM)
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2011 06:51 PM
Here is a business rule we use for Change Requests to log this into the Work Notes
Hope this helps!
Table: sys_attachment
When: After
Insert, Update, Delete are all checked
Condition: current.table_name == "change_request"
var gr = new GlideRecord("change_request");
gr.addQuery("sys_id", current.table_sys_id);
gr.query();
if (gr.next()) {
if (current.operation() == "delete") {
gs.eventQueue("change.attachment.delete", gr, current.file_name, gs.getUserDisplayName());
gr.work_notes = "Attachment: " + current.file_name + " has been deleted by " + gs.getUserDisplayName();
}
else {
gs.eventQueue("change.attachment.insert", gr, current.file_name, gs.getUserDisplayName());
gr.work_notes = "Attachment: " + current.file_name + " has been inserted or updated by " + gs.getUserDisplayName();
}
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2011 06:51 PM
Here is a business rule we use for Change Requests to log this into the Work Notes
Hope this helps!
Table: sys_attachment
When: After
Insert, Update, Delete are all checked
Condition: current.table_name == "change_request"
var gr = new GlideRecord("change_request");
gr.addQuery("sys_id", current.table_sys_id);
gr.query();
if (gr.next()) {
if (current.operation() == "delete") {
gs.eventQueue("change.attachment.delete", gr, current.file_name, gs.getUserDisplayName());
gr.work_notes = "Attachment: " + current.file_name + " has been deleted by " + gs.getUserDisplayName();
}
else {
gs.eventQueue("change.attachment.insert", gr, current.file_name, gs.getUserDisplayName());
gr.work_notes = "Attachment: " + current.file_name + " has been inserted or updated by " + gs.getUserDisplayName();
}
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2011 08:42 AM
Thank you!! That worked perfectly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2013 05:07 PM
This works great! I've applied to the new Human Resource table (hr); to log when an attachment with sensitive data has been deleted. However, I'm noticing that it is colliding with the OOB "Simultaneous Alert" client script. Ideas? Thanks!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2016 04:19 AM
It worked perfectly, I also added the condition for child table as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2012 11:40 AM
First, thanks for the script.
The abouve business rule works great for ITIL users, but not for ESS users. How can I make it to do the same for ESS users.
Thanks
Kumar