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
FinneyFinney 

Is there a feature which shows all the users that view each account or inventory on salesforce????

Can anyone please tell me if  there is a feature which shows all the users that view each account or inventory on salesforce???? Some one told me that we got to write a code. Can anyone please assist me on writing a code?

Best Answer chosen by Admin (Salesforce Developers) 

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

 

Accounts have a share object accoutshare object you can check how many users have a read-only permission to account.

 

Accountshare object has one field accountaccesslevel AND UserOrGroupId.On the basis of UserOrGroupId you can provide the collection of user id for more information you can see accoutnshare object in schema explorer in eclipse IDE. Accountaccesslevel having three picklist values ReadONLY, Read/Write and OWNER.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Prafull G.Prafull G.

Hi Finney,

S Jain (Navatar_DbSup) mentioned the object details which you can use to check whoever having access to account at what level.
In addition to previous post, Just few lines of code which can help you

List<AccountShare> aShare = [Select UserOrGroupId, RowCause, AccountAccessLevel From AccountShare Where AccountId = <Id of Account you want to check>];

Let us know if this helps you.

FinneyFinney

Hi Guys, Thanks for your replies.

 

What I want is :- Can we know which users are viewing an account or inventory?

 

I'm not sure how to do it

 

Can you please help me with this

 

Thanks

FinneyFinney

Hi CRMTech21,

 

Thanks for your reply. 

Can you please tell me where to add this code as I am relatively new to salesforce.

 

More over by doing this can we know all the users who have viewed a certain account.\

 

Thanks

 

Finney

pjcloudpjcloud

There is fundamentally no way to audit record "views" in the platform, as you seem to be asking for.

 

If you want to monitor what has been "done" by someone in SFDC, there are a few things that it does automatically:

1. Who has logged in?

  - Setup > Manage Users > Login History

2. Who has changed this configuration/metadata?

  - Setup > Security Controls > View Setup Audit Trail

3. Who has changed this data?

  - Available for most objects as field history tracking, if it is enabled for 1 or more fields

 

But none of these audit that a user has searched for, viewed, looked at, reported on a given record.

 

I can imagine there are ways you could do this. One way could be to rebuild your view and search pages using visualforce. In the visualforce page action, you might call a method that stores which record/records were looked at, and by whom, in a custom object. If you weren't concerned with search results, but only if someone viewed the detail of a record, you could do this as an inline visualforce page that triggered a custom extension action in the action attribute of the page. If that would do, this wouldn't be so horrendous as rewriting the list/search page.

 

Another possibility might be using custom web service methods with your own custom UI calling Apex methods. Then, within each method ensure that when a record is requested/viewed, you store the fact that it was viewed and by whom.

 

But since there are no hooks for writing Apex that is triggered when data is viewed, there is no way to write a trigger for this, so you'll have to intercept the action to search/view somewhere between the UI and the object.

 

I'm only imagining here and have never built something like this, so maybe someone else has an actual example, or can imagine a more clever way than this...but I think this might be it.

Richie DRichie D

Hi,

 

A solution to this is to build a VF page and add this to the page layout. The VF page can use DML to update a custom object with the current user Id & account Id. The created date of the record will tell you when the account was viewed.

 

Rich.

pjcloudpjcloud
This was selected as the best answer
FinneyFinney

Thanks a lot PJCLoud.

 

Its a wonderful app to audit everything.

 

 

Kind Regards

 

Finney