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
Rohini Sirigiri 5Rohini Sirigiri 5 


How to write trigger on VisualAccessMetrics? I am not able to view VisualAccessMetrics standardobject in the salesforce edition.
ANUTEJANUTEJ (Salesforce Developers) 
Hi Rohini,

I found the below link can you please check if you have the right permissions.

Permissions stated in above link: " As of Spring ’20 and later, to access VisualforceAccessMetrics, users must have the Customize Application permission ".

Hope this helps please close the thread and mark the a best answer so that it can be useful in the future for others and it would also help us in keeping the community clean.

Rohini Sirigiri 5Rohini Sirigiri 5
Hi Anutej,

I am using Developer edition and have the "Customize Application permission " checked in. I am not finding the location of VisualAccessMetrics standard object to write the trigger on it.
ANUTEJANUTEJ (Salesforce Developers) 
Hi Rohini,

If I may ask may I know how you are accessing the "VisualforceAccessMetrics"?

One of the way I fond was to query please find the details below:

Rohini Sirigiri 5Rohini Sirigiri 5
Hi AnuTej,

This is my requirement. I need to find the location of VisualforceAccessMetrics to write a trigger on it.

VisualforceAccessMetrics is a standard table given by salesforce. The purpose of this table is to get some metrics around visual force page usages.
It has fields ApexPageId (Visualforce Page Id), DailyPageViewCount (The number of views received by the specified Visualforce page) and MetricsDate (date on which the VF page is accessed).
This table has around 1 million rows. Sample rows below
ApexPageId                   DailyPageViewCount  MetricsDate
066o0000002vNFiAAM (Page A)  300                 2017-07-25
066o0000002vNFiAAM (Page A)  100                 2019-07-24
066o0000002v8yBAAQ (Page B)  50                  2017-07-23
Metrics__c is a custom object with fields Total_Usages__c (Number type), Last_1_Year_Usages__c(Number type), Last_Access_Date__c (Date Field), VF_Page_Name__c(TextAREA type)
Write Apex Code to query VisualforceAccessMetrics table and store the results in the custom object.
E.g. For above sample data there should be following two rows created in Metrics__c table
VF_Page_Name__c  Total_Usages__c  Last_1_Year_Usages__c Last_Access_Date__c
Page A           400              100                   2019-07-24
Page B           50               0                     2017-07-23
C you help me out figuring this?