Skip to main content
added 2 characters in body
Source Link
sf_user
  • 2.3k
  • 7
  • 35
  • 57

Using this to get below working:

    public class t12345 implements Database.Batchable<sObject> {
    
        String query;
        Boolean xyz;
        
        public t12345(String query){
            this.query= query;
        }

public Database.QueryLocator start(Database.BatchableContext bC){      
    return Database.getQueryLocator(query);
}
    }

and when I run below from developer console,

    Type api = Type.forName('t12345');
    Object apiCall = JSON.deserialize('{"abc""query":"hello world"}',api);
Database.executeBatch((Database.Batchable<sObject>) apiCall);

above execution results in error Argument 1 cannot be null which is coming from start method of batch where query value is still null as constructor with query is not invoked

Using this to get below working:

    public class t12345 implements Database.Batchable<sObject> {
    
        String query;
        Boolean xyz;
        
        public t12345(String query){
            this.query= query;
        }

public Database.QueryLocator start(Database.BatchableContext bC){      
    return Database.getQueryLocator(query);
}
    }

and when I run below from developer console,

    Type api = Type.forName('t12345');
    Object apiCall = JSON.deserialize('{"abc":"hello world"}',api);
Database.executeBatch((Database.Batchable<sObject>) apiCall);

above execution results in error Argument 1 cannot be null which is coming from start method of batch where query value is still null as constructor with query is not invoked

Using this to get below working:

    public class t12345 implements Database.Batchable<sObject> {
    
        String query;
        Boolean xyz;
        
        public t12345(String query){
            this.query= query;
        }

public Database.QueryLocator start(Database.BatchableContext bC){      
    return Database.getQueryLocator(query);
}
    }

and when I run below from developer console,

    Type api = Type.forName('t12345');
    Object apiCall = JSON.deserialize('{"query":"hello world"}',api);
Database.executeBatch((Database.Batchable<sObject>) apiCall);

above execution results in error Argument 1 cannot be null which is coming from start method of batch where query value is still null as constructor with query is not invoked

added 128 characters in body
Source Link
sf_user
  • 2.3k
  • 7
  • 35
  • 57

Using this to get below working:

    public class t12345 implements Database.Batchable<sObject> {
    
        String abc;query;
        Boolean xyz;
        
        public t12345()String query){
            systemthis.debug('called');query= query;
        }
        
        public t12345Database.QueryLocator start(StringDatabase.BatchableContext abcbC){
            this.abc = abc;
           return system.debug(abc);
systemDatabase.debuggetQueryLocator('hello'query);
        }
    }

and when I run below from developer console,

    Type api = Type.forName('batchclass''t12345');
//api.newInstance(); --> this outputs "Called" in default constructor as expected
Object apiCall = JSON.deserialize('{"abc":"hello world"}',api);
systemDatabase.debugexecuteBatch(apiCall);
system.debug(apiCall !=Database.Batchable<sObject>) nullapiCall); //executes as true

I am trying to output debug in parameterized constructor.

apiCall returns object and I want to call my batch using that object as belo: Database.executeBatch((Database.Batchable<sObject>) apiCall);

above execution results in error Argument 1 cannot be null which is coming from start method of batch whichwhere query value is using abcstill null as constructor with query is not invoked

Using this to get below working:

    public class t12345 {
    
        String abc;
        Boolean xyz;
        
        public t12345() {
            system.debug('called');
        }
        
        public t12345(String abc){
            this.abc = abc;
            system.debug(abc);
system.debug('hello');
        }
    }

and when I run below from developer console,

Type api = Type.forName('batchclass');
//api.newInstance(); --> this outputs "Called" in default constructor as expected
Object apiCall = JSON.deserialize('{"abc":"hello world"}',api);
system.debug(apiCall);
system.debug(apiCall != null); //executes as true

I am trying to output debug in parameterized constructor.

apiCall returns object and I want to call my batch using that object as belo: Database.executeBatch((Database.Batchable<sObject>) apiCall);

above execution results in error Argument 1 cannot be null which is coming from start method of batch which is using abc

Using this to get below working:

    public class t12345 implements Database.Batchable<sObject> {
    
        String query;
        Boolean xyz;
        
        public t12345(String query){
            this.query= query;
        }

public Database.QueryLocator start(Database.BatchableContext bC){      
    return Database.getQueryLocator(query);
}
    }

and when I run below from developer console,

    Type api = Type.forName('t12345');
    Object apiCall = JSON.deserialize('{"abc":"hello world"}',api);
Database.executeBatch((Database.Batchable<sObject>) apiCall);

above execution results in error Argument 1 cannot be null which is coming from start method of batch where query value is still null as constructor with query is not invoked

added 128 characters in body
Source Link
sf_user
  • 2.3k
  • 7
  • 35
  • 57

Using this to get below working:

    public class t12345 {
    
        String abc;
        Boolean xyz;
        
        public t12345() {
            system.debug('called');
        }
        
        public t12345(String abc){
            this.abc = abc;
            system.debug(abc);
system.debug('hello');
        }
    }

and when I run below from developer console,

Type api = Type.forName('t12345''batchclass');
//api.newInstance(); --> this outputs "Called" in default constructor as expected
Object apiCall = JSON.deserialize('{"abc":"hello world"}',api);
system.debug(apiCall);
system.debug(apiCall != null); //executes as true

I am trying to output debug in parameterized constructor.

apiCall returns object and I want to call my batch using that object as belo: Database.executeBatch((Database.Batchable<sObject>) apiCall);

above execution results in error Argument 1 cannot be null which is coming from start method of batch which is using abc

Using this to get below working:

    public class t12345 {
    
        String abc;
        Boolean xyz;
        
        public t12345() {
            system.debug('called');
        }
        
        public t12345(String abc){
            this.abc = abc;
            system.debug(abc);
system.debug('hello');
        }
    }

and when I run below from developer console,

Type api = Type.forName('t12345');
//api.newInstance(); --> this outputs "Called" in default constructor as expected
Object apiCall = JSON.deserialize('{"abc":"hello world"}',api);
system.debug(apiCall);
system.debug(apiCall != null); //executes as true

I am trying to output debug in parameterized constructor.

apiCall returns object and I want to call my batch using that object as belo: Database.executeBatch((Database.Batchable<sObject>) apiCall);

Using this to get below working:

    public class t12345 {
    
        String abc;
        Boolean xyz;
        
        public t12345() {
            system.debug('called');
        }
        
        public t12345(String abc){
            this.abc = abc;
            system.debug(abc);
system.debug('hello');
        }
    }

and when I run below from developer console,

Type api = Type.forName('batchclass');
//api.newInstance(); --> this outputs "Called" in default constructor as expected
Object apiCall = JSON.deserialize('{"abc":"hello world"}',api);
system.debug(apiCall);
system.debug(apiCall != null); //executes as true

I am trying to output debug in parameterized constructor.

apiCall returns object and I want to call my batch using that object as belo: Database.executeBatch((Database.Batchable<sObject>) apiCall);

above execution results in error Argument 1 cannot be null which is coming from start method of batch which is using abc

added 150 characters in body
Source Link
sf_user
  • 2.3k
  • 7
  • 35
  • 57
Loading
Source Link
sf_user
  • 2.3k
  • 7
  • 35
  • 57
Loading