Tuesday, April 23, 2019

How to get all batch apex class names in org?

This post explains how to get all apex batch class names list in Org.

Example:

list<ApexClass> lstApexClasses = [SELECT Id, Name, ApiVersion, Body FROM ApexClass where NamespacePrefix = null];
for(ApexClass iterator : lstApexClasses) {
    if(iterator.Body.contains('Database.Batchable')) {
        system.debug('Batch Class Name ====> '+iterator.Name+' Api Version ====> '+iterator.ApiVersion);
    }
}

Result

No comments:

Post a Comment