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
Thomas TrinhThomas Trinh 

Is there a way to retrieve NetworkUserHistoryRecent data?

I tried to use NetworkUserID to retrieve NetworkUserHistoryRecent data but it's returning nothing. I want to get all the information of certain user activities in Community. Is there a way to do that?
SwethaSwetha (Salesforce Developers) 
HI Thomas,
The query to extract NetworkUserHistoryRecent data is something like 
SELECT LastModifiedById, SystemModstamp, CreatedById, LastModifiedDate, CreatedDate, IsDeleted, Id, AccessTimestamp, RecordId, FeedCommentId, NetworkUserId, FeedItemId, RecordKeyPrefix, NetworkId, ActionType, UserType, DomainName, Url, CombinedIdField FROM NetworkUserHistoryRecent where NetworkUserId ='0057F000000EXKEQA4'
You can get the NetworkUserId  from NetworkMember(https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_networkmember.htm)
select MemberId from NetworkMember

Bulk extraction is not supported in NetworkUserHistoryRecent object.I hope you are following the same steps. If you still do not see any records, check if the criteria is met so that SOQL can fetch the results. Let me know in case of followup queries. Thanks
Damon ShawDamon Shaw

Did you have any luck Thomas? I'm having the same issue, I query NetworkUserHistoryRecent where NetworkUserId = a user's Id and I get 0 even though they last logged in yesterday.

Our users have access to their normal community and we've just implemented a new B2B commerce storefront community for them too and would like to be able to know if thay're just accessing the normal community or have they had a look at the B2B one yet.