You need to sign in to do that
Don't have an account?
A field to capture who is currently viewing a record
Is there a way to capture which users are currently viewing a record? We want to make use of the console view but don't want users accessing a record if another user is already viewing it.
solution 1:
You can do this by a custom solution:
(i) Create a field on the Custom Object say 'Record View Count(Record_View_Count__c)' of type - Number(18,0).
(ii) Then create a Visualforce Page like this:
Label: Record View Tracker
Name: RecordViewTracker
<apex:page standardController="Case">
<apex:includeScript value="/soap/ajax/28.0/connection.js"/>
<script type="text/javascript">
sforce.connection.sessionId = '{!GETSESSIONID()}';
var object = new sforce.SObject('Case');
object.Id = "{!Case.Id}";
object.Record_View_Count__c = {!Case.Record_View_Count__c} + 1;
var result = sforce.connection.update([object]);
if(result[0].success != 'true'){
alert('Could not Update the Record View Tracking Information. \r\nError: ' + result[0].errors.message);
}
</script>
</apex:page>
(iii) Then go to the Page Layout(say the Cases for now) > Edit It > Select Visualforce Pages from the Page Host > Drag our new 'RecordViewTracker' on to the Page Layout > Click on the Wedge Icon > Set Height: 0 and Width: 0(so that it is not displayed on the Page).
(iv) Save it.
Working: Whenever someone views the record via the Salesforce UI, then the JavaScript within the In-line Visualforce Page will be executed and the Record View Count on the Oppty record will increment by 1. Also, you need not put the Record View Count field on the Page Layout.
Now, if you want it on an another Custom Object/Standard Object just do these:
(i) Find and Replace 'Case' with the API Name of that object of concern.
(ii) Make sure you have created the Record View Count field on that Custom Object.
(iii) Drag it to the Page Layout too.
Solution 2:
Appexchange:
https://appexchange.salesforce.com/listingDetail?listingId=a0N300000055aKGEAY
Please check the Below link for reference.
Please mark it as best Answer if it resolved the issue.