You need to sign in to do that
Don't have an account?

Invalid type: DMLResults
i m making a batchable class for reduce development efforts..i m referring cookbook of salasforce...nd i m getting this error
ERROR :: Invalid type: DMLResults
CODE:
global class batchRefresh implements Database.Batchable<Sobject>, Database.Stateful {
global final string query;
global DMLResults unsuccessfuls;
global batchRefresh(String q){
Query=q;
}
global Database.QueryLocator start(Database.BatchableContext BC){
unsuccessfuls= new DMLResults();
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, LIST<SObject> scope){
unsuccessfuls.add(Database.update(scope,false),scope);
}
global void finish(Database.BatchableContext BC) {
unsuccessfuls.batchOnFinish(BC.getJobId());
}
}
ERROR :: Invalid type: DMLResults
CODE:
global class batchRefresh implements Database.Batchable<Sobject>, Database.Stateful {
global final string query;
global DMLResults unsuccessfuls;
global batchRefresh(String q){
Query=q;
}
global Database.QueryLocator start(Database.BatchableContext BC){
unsuccessfuls= new DMLResults();
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, LIST<SObject> scope){
unsuccessfuls.add(Database.update(scope,false),scope);
}
global void finish(Database.BatchableContext BC) {
unsuccessfuls.batchOnFinish(BC.getJobId());
}
}
first save DmlResults class then you can save your apex batch class
(you can also find below class in that cookbook) let me inform if it helps you
thanks
thanks