Welcome to my blog

I have been working with Salesforce for quite a while, so don’t hesitate to contact me if you have any questions or want some advice.

s f

Subscribe
Follow Us
h

How to find number apex batch class in my org?

 . Apex  . How to find number apex batch class in my org?

How to find number apex batch class in my org?

How to Find Number Apex Batch Class For Salesforce in Your Org?

Please run below script in developer console anonymous or workbench anonymous window. You will receive email with csv file attachment.

list<ApexClass> lstApex = [SELECT Id, NamespacePrefix, Name, ApiVersion, Status, IsValid, BodyCrc, Body, LengthWithoutComments FROM ApexClass where NamespacePrefix = null];
string excelHeader = ‘ApexName\n’;
for(ApexClass iterator : lstApex) {
if(iterator.Body.contains(‘Database.Batchable’)) {
system.debug(iterator.Name);
excelHeader += iterator.Name +’\n’;
}
}
Messaging.EmailFileAttachment csvAttc = new Messaging.EmailFileAttachment();
blob csvBlob = Blob.valueOf(excelHeader);
string csvname= ‘ApexClassBatchName.csv’;
csvAttc.setFileName(csvname);
csvAttc.setBody(csvBlob);
Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage();
String[] toAddresses = new list<string> {‘Enter your email address’};
String subject =’Apex Batch Class Name CSV’;
email.setSubject(subject);
email.setToAddresses( toAddresses );
email.setPlainTextBody(‘Apex Batch Class Name CSV ‘);
email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvAttc});
Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});

Post a Comment