I need to run a scheduled batch out of schedule. It has been working every day perfectly for months.

I went to try to run it in Execute Anonymous but I get the error: Method does not exist or incorrect signature void format string from the type anon

Id batchJobId = Database.executeBatch(Update_IC_CampaignBatch(),200);
system.debug(' \n SEAN DEBUG = '+batchJobId);

This is the batch:

GLOBAL CLASS Update_IC_CampaignBatch implements Database.Batchable <SObject> {
    GLOBAL Database.queryLocator start(Database.BatchableContext ctx) {
        String lsStatus = 'ICReady';
        string query = 'SELECT id,Name from Lead WHERE status=:lsStatus'  ;
        RETURN database.getQueryLocator(query);

    GLOBAL VOID execute(Database.BatchableContext BC, List <Lead> scope) {
        Set<ID> leadIDs= new Set<ID>();
        for(Lead l: scope){
        Set<ID> campaignIDs = new Set<ID>();
        for(CampaignMember cm : [SELECT CampaignID, LeadID, Status FROM CampaignMember WHERE LeadID IN : leadIDs]){

        list<Campaign> listCampaign = new list<Campaign>();
        for(Campaign c : [select Id, Status, Name, Parent.Name from Campaign where Id IN : campaignIDs ]){
            if(c.Name.left(11) == 'IC Campaign'){
                c.Status = 'IC Daily Campaign Ready';
                c.Status = c.Parent.Name + ' Campaign Ready';
        update listCampaign;

    GLOBAL VOID finish(Database.BatchableContext BC) {

You are missing to create the instance of the class using new keyword.

Id batchJobId = Database.executeBatch(Update_IC_CampaignBatch(),200); // missing new

It should be:

Id batchJobId = Database.executeBatch(new Update_IC_CampaignBatch(),200);

Update_IC_CampaignBatch batch1 = new Update_IC_CampaignBatch(); Database.executeBatch(batch1);

  • While this does provide an answer but you may like to add more details to this highlighting the original issue vs. how to fix this.
    – Jayant Das
    Apr 5 '19 at 15:38
  • Sorry for a loosely typed answer. I'm new in this form, but I got the point. Thanks for the tip.
    – Watson
    May 2 '19 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.