Created
February 3, 2017 20:36
-
-
Save jongpie/b5bc65b783846d59afff82703d7908a4 to your computer and use it in GitHub Desktop.
See API version for classes, pages & triggers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ApexClass | |
System.debug('Starting ApexClass analysis'); | |
Map<Decimal, Integer> apexClassMap = new Map<Decimal, Integer>(); | |
List<ApexClass> apexClassList = [ | |
SELECT Id, Name, ApiVersion | |
FROM ApexClass | |
WHERE NamespacePrefix = null | |
AND (NOT Name LIKE '%Test') | |
ORDER BY ApiVersion, Name | |
]; | |
for(ApexClass apexClass : apexClassList) { | |
Decimal apiV = apexClass.ApiVersion; | |
if(!apexClassMap.containsKey(apiV)) apexClassMap.put(apiV, 1); | |
else apexClassMap.put(apiV, apexClassMap.get(apiV) + 1); | |
} | |
for(Decimal apiVersion : apexClassMap.keySet()) { | |
System.debug(apiVersion + ': ' + apexClassMap.get(apiVersion) + ' files'); | |
} | |
// ApexPage | |
System.debug('Starting ApexPage analysis'); | |
Map<Decimal, Integer> apexPageMap = new Map<Decimal, Integer>(); | |
List<ApexPage> apexPageList = [ | |
SELECT Id, Name, ApiVersion | |
FROM ApexPage | |
WHERE NamespacePrefix = null | |
AND (NOT Name LIKE '%Test') | |
ORDER BY ApiVersion, Name | |
]; | |
for(ApexPage ApexPage : apexPageList) { | |
Decimal apiV = ApexPage.ApiVersion; | |
if(!apexPageMap.containsKey(apiV)) apexPageMap.put(apiV, 1); | |
else apexPageMap.put(apiV, apexPageMap.get(apiV) + 1); | |
} | |
for(Decimal apiVersion : apexPageMap.keySet()) { | |
System.debug(apiVersion + ': ' + apexPageMap.get(apiVersion) + ' files'); | |
} | |
// ApexTrigger | |
System.debug('Starting ApexTrigger analysis'); | |
Map<Decimal, Integer> apexTriggerMap = new Map<Decimal, Integer>(); | |
List<ApexTrigger> apexTriggerList = [ | |
SELECT Id, Name, ApiVersion | |
FROM ApexTrigger | |
WHERE NamespacePrefix = null | |
AND (NOT Name LIKE '%Test') | |
ORDER BY ApiVersion, Name | |
]; | |
for(ApexTrigger ApexTrigger : apexTriggerList) { | |
Decimal apiV = ApexTrigger.ApiVersion; | |
if(!apexTriggerMap.containsKey(apiV)) apexTriggerMap.put(apiV, 1); | |
else apexTriggerMap.put(apiV, apexTriggerMap.get(apiV) + 1); | |
} | |
for(Decimal apiVersion : apexTriggerMap.keySet()) { | |
System.debug(apiVersion + ': ' + apexTriggerMap.get(apiVersion) + ' files'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment