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
uri-dev1.392024776339377E12uri-dev1.392024776339377E12 

Trigger by "View" Event

Hi,
Is there any way of audit or listen to "view" events of a specific object and field in Salesforce?
View can be either via the application of via an API.
Thanks,
Uri
Ashish_SFDCAshish_SFDC
Hi Uri, 

Can you explain a litttle more, what are you referring to events of specific objects.

Regards,
Ashish 
uri-dev1.392024776339377E12uri-dev1.392024776339377E12
Hi Ashish, By view event I mean that I want to be able track access (read) of a specific field that may hold sensitive information. Uri
Elie.RodrigueElie.Rodrigue
You can create a visual force component that display the value of your field and replace the actual field in your page layout by the component. This way you'll be able to run the code you want on the action you want.

There's no view events or trigger available, and any solution you'll find will impact performance. 

uri-dev1.392024776339377E12uri-dev1.392024776339377E12
Hi Elie, Thanks for the reply. Unless I don't fully understand, the solution you suggest cant 'catch' read operations that are not controlled by my visual force page (API calls and access via other places in the application). Thanks, Uri
Elie.RodrigueElie.Rodrigue
Exactly. There's no events fired when you retrieve a row through the api. You can only catch some browser based view operation. 
You can rework you solution to fire actions instead of requesting data. Lets say you have an external software that display some sf data. Instead of doing SOQL query using enterprise wsdl you could call an apex webservice that returns your rows but also do some operation.

Same with visual force.
Ashish_SFDCAshish_SFDC
Hi Uri, 


You can Track "$User.FirstName  $User.LastName" when a page is loaded with a Onload function and STore the values with Now() Time in a List. 

See the discussion in the link below, 

https://developer.salesforce.com/forums/ForumsMain?id=906F00000008p03IAA


Regards,
Ashish
Elie.RodrigueElie.Rodrigue
Wouldnt using $User.FirstName & $User.LastName always return the current user?? So if you do an soql query on the object, it would return the current user name, the one that does the actual query, not the one that last saw it...

Any hack based on this, will have the same issue, it will only work browser based. If you query data from outside saleforce.com web ui, it wont track the "view" event. 

The appexchange package related in the other post is also browser based. 

There's will be no way to run code on a "get/view" event as those are not available, you need to figure out other event to bind to : browser refresh, method call on webservice... 


uri-dev1.392024776339377E12uri-dev1.392024776339377E12
Elie, Ashish,
I really appreciate your help here.
I see that there is a very limited audit capability by quering "RecentlyViewed" objects. The problem is that it provides data only for the current login user and that its at a level of a record rather than a field.
I see ezCloudAudit claims (https://appexchange.salesforce.com/listingDetail?listingId=a0N300000055aKGEAY) to provide this information. How can they do that? Do they have access to Salesforce's private API? Is there a public API that I'm missing? Do they bluff :) ? 
Uri
Elie.RodrigueElie.Rodrigue
They are doing it browser based. As previously stated, you can do that. One way of doing it would be through a vf component in the objects you want to track. But I guess what they are doing is adding some javascript code in an homepage component. This javascript code analyse what you are doing and create some logs based on that (Similar to google analytics in some way). However it doesnt track calls made from an api. Elie Rodrigue Nubik.ca 1-888-NUBIK-55 ext 700
Elie.RodrigueElie.Rodrigue
We're you able to figure something out ?
You could also override the view page in salesforce by a visualforce page this way you would have some come running on each view, however you would still not be able to track the api calls.