In every user page we have a chatter that shows the user activity, which record he updated etc
How can i get that user's activity in a SOQL Query?
In every user page we have a chatter that shows the user activity, which record he updated etc
How can i get that user's activity in a SOQL Query?
I ended up with this query, to get the user activity on a specific record:
SELECT Id,
(Select FieldName, OldValue, NewValue FROM FeedTrackedChanges),
CreatedDate,ParentId
FROM AccountFeed WHERE CreatedById = '<Id>' AND CreatedDate > 2019-10-25T12:00:00.000+0000 and CreatedDate < 2019-10-25T13:00:00.000+0000
To query a different object, change the AccountFeed
to the object's feed.
If you are referring to tracked changes such as Record modification you can use the FeedItem in a similar manner than the following:
select Id, Body, CommentCount, CreatedDate, LikeCount, LinkUrl, ParentId, RelatedRecordId, Title, Type from FeedItem WHERE CreatedById = '0056g000000xrvgAEI'
You can further get the changed values by querying the FeedItemTrackedChange object which you can pull by using the FeedItem id
If you are looking to pull all chatter comments under one of these changes it will require additional queries as well.
The short answer is if you were to want to rebuild this feed's look and feel by getting the queries yourself, it will require several queries AND preprocessing before loading.