I have the following batchable class:
global class batchableClassName implements Database.Batchable<sObject>, Database.AllowsCallouts
{
global Database.QueryLocator start(Database.BatchableContext BC)
{
String query = 'SELECT Company, Website FROM Lead';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<Lead> scope)
{
for(Lead l : scope)
{
Class.function(l.Website);
}
update scope;
}
global void finish(Database.BatchableContext BC) {
}
}
Instead of hard typing the SOQL query within the batchable class I would like to be able to pass a query to the function when running it, for example:
batchableClassName.batchableClassFunction('SELECT Company, Name FROM Lead WHERE Status = \'Active\'');
I found some info about this on Stack Exchange but struggle to apply it to my particular problem.