Issue
Description
We can track the users who have exported the records from say hr_case , incident.list etc through the below steps.
Procedure
- When a user navigates to incident.list or hr_case.list.
- Exports the list by doing right click on the header and export the list to csv/pdf or any other formal
- A record will be inserted into sys_poll (Job Pollings) table and the corresponding record will be inserted into sys_attachment and sys_attachment_doc table.
- Admins or any users can navigate to sys_attachment table and search all the records where table name=sys_poll
https://<Instance name>.service-now.com/sys_attachment_list.do?sysparm_query=table_nameSTARTSWITHsys_poll
- It displays all the attachment records that has been exported by the users
- But the records will be removed from sys_poll and sys_attachment whenever the respective users logout.
- When a user logs out of the instance a logout event will be triggered in sysevent table, while processing the event a script action called "Cleanup Resources" will be executed.
- This script action cleans up all the sys_poll and sys_attachment data for the logged out user in this case there is chance that users can't track the users that had done the exports on the list of records.
- Inorder to keep track of the users who have done exports, a custom table can be created say u_trackusers.
- Define a business rule on sys_attachment table.
- When to run: After Insert
- In the Condition field add current.table_name=="sys_poll" && current.operation()=='insert'
- Click on Advanced tab(If not there, check the Advanced field on the form)
- Add the code in the script section and save. Below is the sample code has been added. Users can add the code of their choice that meet their requirement.
Note: The above business rules inserts a record into u_trackusers after a record in inserted into sys_attachment table that are related to the sys_poll table.
Applicable Versions
- All