Skip to main content
Chakra Varthi Konreddy (Salesforce) 님이 #Apex에 질문했습니다
Is there any possibility to track down the users who looked at particular records...clients requirement data is very confidential so they are expecting if there is any posibility to know every user who looked into a record
답변 3개
  1. 2016년 5월 23일 오후 9:10
    If you are trying to track all the users who viewed a file, I would create an object and store the record viewers in that object

    E.g.: If I am trying to track users who viewed Account.

    Create an object AccountViews. Create 2 lookup fields to Account and User

    Create an apex extension class  with the following method 

     

    public void trackViews(){

    AccountViews av= new AccountViews(Account__c=acc.Id, ViewedBy=UserInfo.getUserId());

    try{

    insert av;

    }catch(DmlException e){

    System.debug('Account viewer record not created');

    }

    }

    Add this line to VF Page

    <apex:page StandardController="Account" extensions="AccountExtension" action="{!trackViews}">

    Don't forget to give create permissions to all the users
0/9000