Skip to main content
Arun Reddy ha preguntado en #Collaboration
Hi

 

We are trying to track all activity for all users of a given organization in Salesforce. As I understand, SOQL is the way to get the activity records(Please suggest of there is any other better way).

 

We created a Managed Connected app, which gets a OAuth token from the customer, which will be used for the SOQL apis.

 

One of the objects that worked for us is LoginHistory, which gives all the records for user logging in. Similarly, we were trying to get all user activity on all objects in Sales console. Objects we want to keep track of are:

 

Leads, Accounts, Files, Tasks, Campaigns, Calendar, Reports, Dashboards, Opportunities, etc

 

We tried using LeadHistory, ActivityHistory, etc, but none of them are working in SOQL.

 

The api we are using is:

 

https://na57.salesforce.com/services/data/v42.0/query/?q=<<query>>

 

For example:

 

https://na57.salesforce.com/services/data/v42.0/query/?q=SELECT UserId,LoginTime from LoginHistory limit 100

 

This api works

 

and 

 

https://na57.salesforce.com/services/data/v42.0/query/?q=SELECT Id,Name,Email, OwnerId, (SELECT ActivityDate, Description from ActivityHistories) FROM Lead

 

Does gives all the leads, but the ActivityHisotries are null for them.

 

Please suggest where I am going wrong in this.
3 respuestas
  1. 27 sept 2018, 4:48
    Field history tracking needs to be enabled per object, and can only track up to 20 selected fields. If you're trying to get a full activity history of what the user is doing, this approach will not work.

     

    You may want to consider creating a series of triggers that records these operations inside a Big Object. You might also be interested in Event Monitoring (https://help.salesforce.com/articleView?id=Enabling-Event-Monitoring&language=en_US&type=1&sfdcIFrameOrigin=null).
0/9000