function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ramssf70Ramssf70 

can we track the activities of user in apex?

Hi All,

can we track the activities of all users in apex?
 
Best Answer chosen by Ramssf70
NagendraNagendra (Salesforce Developers) 
Hi Ram,

You can use the Event Logs to monitor a range of event types(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#event-types), including:

Asynchronous Report Run(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#async-report):
"Asynchronous Report Run events are created for reporting requests that are scheduled. This category includes dashboard refreshes, asynchronous reports, schedule reports, and analytics snapshots."


Content Distribution(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#content-distribution):
"Content Distribution events contain information about content distributions and deliveries to users."


Content Transfer:(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#content-transfer)
Content Transfer events contain information about content transfer events, such as downloads, uploads, and previews.


Document Attachment Downloads(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#document-attachment-downloads)
Document Attachment Downloads events contain details of document and attachment downloads.


Report(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#report):
Report events contain information about what happened when a user ran a report.


Report Export(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#report-export):
Report Export events contain details about reports that a user exported.


UI Tracking(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#ui-tracking):
UI Tracking events contain details about user interactions wit the mobile UI.


URI(https://developer.salesforce.com/docs/atlas.en-us.198.0.api.meta/api/sforce_api_objects_eventlogfile.htm#uri-event):
URI events contain details about user interaction with the web browser UI.
From that shortened list I think URI, Report and Document Attachment Download will give you most of the data you want.

Note that outside of a developer edition org the Event Logs are a paid feature.

Hope this helps.

Best Regards,
Nagendra.