Why can't I save this SalesForce Batchable class? -
i using apex workbook refresh knowledge of salesforce.
tutorial #15, lesson 1: offers following code:
global class cleanuprecords implements database.batchable<object> { global final string query; global cleanuprecords (string q) {query = q;} global database.querylocator start (database.batchablecontext bc) { return database.getquerylocator(query); } global void execute (database.batchablecontext bc, list<sobject> scope) { delete scope; database.emptyrecyclebin(scope); } global void finish(database.batchablecontext bc) { asyncapexjob = [ select id, status, numberoferrors, jobitemsprocessed, totaljobitems, createdby.email asyncapexjob id = :bc.getjobid() ]; // send email apex job's submitter // notifying of job completion. messaging.singleemailmessage mail = new messaging.singleemailmessage(); string[] toaddresses = new string[] {a.createdby.email}; mail.settoaddresses(toaddresses); mail.setsubject('record clean completed ' + a.status); mail.setplaintextbody ( 'the batch apex job processed ' + a.totaljobitems + ' batches '+ a.numberoferrors + ' failures.' ); messaging.sendemail(new messaging.singleemailmessage[] { mail }); } }
however, regardless of development interface (e.g. force ide, console, setup) use, when try save this, get:
multiple markers @ line - file saved locally, not server - save error: cleanuprecords: class must implement global interface method: iterable<object> start(database.batchablecontext) database.batchable<object>, cleanuprecords: class must implement global interface method: void execute(database.batchablecontext, list<object>) database.batchable<object>
(or equivalent, depending upon how try save it.)
however, seems me required methods there.
what's missing?
prepare frustrated ... there's 1 character off.
your class declaration should be:
global class cleanuprecords implements database.batchable<sobject> {
instead of:
global class cleanuprecords implements database.batchable<object> {
Comments
Post a Comment