Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Re: Argument must be an object that implements Dat...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Argument must be an object that implements Database.B atchable
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-15-2012 08:46 AM - edited 11-15-2012 09:05 AM
Im trying to run a batch apex for my code
/*************************************************
EscalateAnnualEnrollmentTaskProcess AE = new EscalateAnnualEnrollmentTaskProcess();
database.executebatch(AE);
/*************************************************
global class TaskProcess implements Schedulable {
global void execute(SchedulableContext ctx)
{
/* */
List<Request__c> requestIds = [SELECT Id FRO
/* list of tasks associated near overdue activitydate - 5*/
List<Task>Overdue =new List<Task>([SELECT Id
/* iterate over the tasks */
for (Task t:tasksNearOverdue) {
/* lookup the object */
Request__c request = [SELECT Id, Project_Manager_
/* lookup the user and send the email*/
User manager = [SELECT Id, Name, Email FROM User WHERE
sendemail(projectmanager, t);
/* lookup the user and send the email */
User director = [SELECT Id, Name, Email
sendemail(director, t);
}
}
global void sendemail(User u, Task t)
{
Messaging.SingleEmailMessage email = new Mes
string[] toaddress = New String[] {u.Email};
email.setSubject('Task Almost Overdue');
email.setPlainTextBody(t.Subject + 'is due '
email.setToAddresses(toaddress);
Messaging.sendEmail(New Messaging.SingleEmai
}
}
Solved! Go to Solution.
Re: Argument must be an object that implements Database.B atchable
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-15-2012 08:48 AM
It is giving me the error " Argument must be an object that implements Database.Batchable"
Re: Argument must be an object that implements Database.B atchable
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-15-2012 08:51 AM
This is because you are implementing the schedulable rather than batchable interface Shedulable allows apex code to be scheduled, but you can't invoke executebatch on it.
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.
Re: Argument must be an object that implements Database.B atchable
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-15-2012 09:04 AM
Thanks Bob. This code is for email alerts for the project manager and Directors for Overdue tasks. I wanted to see if the code is working.. How do I test for schedulable jobs
Re: Argument must be an object that implements Database.B atchable
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-15-2012 09:14 AM
There's an example test class at:
http://www.salesforce.com/us/developer/docs/apexco
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.
Re: Argument must be an object that implements Database.B atchable
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-15-2012 09:25 AM
Thanks Bob.. I wil figure it out..
Re: Argument must be an object that implements Database.B atchable
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-26-2013 03:08 AM
Hi,
In your apex class add the (implements Database.Batchable<sObject>) line,
instead of implements Schedulable
For Ex,
global class TaskProcess implements Database.Batchable<sObject> {
//your code
for more info read theblogreaders.com

