- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 05:03 AM
In the 'sysevent' table there's a parameter Name = 'attachment.read' which shows when a user views/downloads a document from a record (I'm looking at cases).
What I'm trying to do is differentiate between a document that was viewed (using the enabled 'Document Viewer') and those which are downloaded.
Something like Name = 'attachment.view' would be perfect.
Is there anyway this is possible?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 05:26 AM
Unfortunately, ServiceNow does not differentiate between viewing and downloading an attachment out of the box. The 'attachment.read' event is triggered both when a user views or downloads an attachment. However, you can potentially create a custom solution to achieve this. Here are the steps:
1. Create a UI Action on the 'sys_attachment' table. This UI Action will be responsible for logging when a user views an attachment.
2. In the UI Action script, use the GlideRecord API to create a new record in a custom logging table every time the UI Action is triggered.
3. The custom logging table should have fields to store information about the user, the attachment, and the action (view or download).
4. Modify the 'Document Viewer' widget to trigger the UI Action when a user views an attachment.
5. For tracking downloads, you can continue to use the 'attachment.read' event. You can create a Business Rule or Script Action that creates a record in the custom logging table every time the 'attachment.read' event is triggered.
6. To differentiate between views and downloads, you can check if a view log exists in the custom logging table for the same user and attachment within a certain time frame of the download log. If it does, you can assume that the download was preceded by a view.
Please note that this is a custom solution and may require significant development and testing. It may also have performance implications depending on the volume of attachment views and downloads in your instance.
Please mark it Correct and Hit Like if you find this helpful!
Regards,
Karthiga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2023 05:26 AM
Unfortunately, ServiceNow does not differentiate between viewing and downloading an attachment out of the box. The 'attachment.read' event is triggered both when a user views or downloads an attachment. However, you can potentially create a custom solution to achieve this. Here are the steps:
1. Create a UI Action on the 'sys_attachment' table. This UI Action will be responsible for logging when a user views an attachment.
2. In the UI Action script, use the GlideRecord API to create a new record in a custom logging table every time the UI Action is triggered.
3. The custom logging table should have fields to store information about the user, the attachment, and the action (view or download).
4. Modify the 'Document Viewer' widget to trigger the UI Action when a user views an attachment.
5. For tracking downloads, you can continue to use the 'attachment.read' event. You can create a Business Rule or Script Action that creates a record in the custom logging table every time the 'attachment.read' event is triggered.
6. To differentiate between views and downloads, you can check if a view log exists in the custom logging table for the same user and attachment within a certain time frame of the download log. If it does, you can assume that the download was preceded by a view.
Please note that this is a custom solution and may require significant development and testing. It may also have performance implications depending on the volume of attachment views and downloads in your instance.
Please mark it Correct and Hit Like if you find this helpful!
Regards,
Karthiga