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
John Manager Training DepJohn Manager Training Dep 

Get list of Visual Force pages, Apex classes, Triggers and aura components used?

Hi Team,

I want to get list of Visual Force pages, Apex classes, Triggers and aura components used?

For finding the VF pages used in the last 90 days, I am using the SOSL mentioned below,
SELECT Id, Markup, Name FROM ApexPage WHERE Id IN (SELECT ApexPageId FROM VisualforceAccessMetrics)

Can someone let me know if this is correct?

Als how do I get list of , Apex classes, Triggers and aura components used in last 90 days or so?

Many Thanks for all your help and support!
Rochak ShastriRochak Shastri
Yes your would work for VF page. You may also add teh date criteria like this:
SELECT Id, Markup, Name FROM ApexPage WHERE Id IN (SELECT ApexPageId FROM VisualforceAccessMetrics where LogDate = LAST_90_DAYS) 

For Aura you can get this list if you are on API version 43+.:
 SELECT MetricsDate,UserId,TotalCount,PageName FROM LightningUsageByPageMetrics Where MetricsDate = Last_90_DAYS

I don't think there is any such API Object avaiable for APex classes and triggers
MagulanDuraipandianMagulanDuraipandian
Check this - https://developer.salesforce.com/docs/atlas.en-us.packagingGuide.meta/packagingGuide/usage_metrics_visualization.htm
--
Magulan Duraipandian
www.infallibletechie.com
John Manager Training DepJohn Manager Training Dep
Thanks very much both.
In the website - https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_tools_metrics.htm
i see that "Page views are tallied the day after the page is viewed, and each VisualforceAccessMetrics object is removed after 90 days."

I thought it meant that history is kept for 90 days. But based on the query it seems that history is available for much more than 90 days.

Is this a change?
Deepali KulshresthaDeepali Kulshrestha
Hi John,
Greetings to you!


List<ApexPage> apexPageList=[SELECT Id, Markup, Name FROM ApexPage WHERE Id IN (SELECT ApexPageId FROM VisualforceAccessMetrics) Limit 10000];
List<VisualforceAccessMetrics> vfPageList=[SELECT ApexPageId, DailyPageViewCount, Id, MetricsDate FROM VisualforceAccessMetrics LIMIT 10000];
System.debug('apexPageList-->'+apexPageList);
System.debug('vfPageList-->'+vfPageList);
    
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.
 
John Manager Training DepJohn Manager Training Dep
Does this give Aura component usage details?