I have written batch apex code which will send a Good morning message to my Chatter group. I want to write scheduler class for this batch apex.
global class PostMessage Implements Database.batchable<sObject>
{
global Database.queryLocator start(Database.BatchableContext BC)
{
return Database.getqueryLocator([Select id,Name from CollaborationGroup where Name='Techila Group' LIMIT 1]);
}
global void execute(Database.BatchableContext BC,List<Account> acct)
{
FeedItem post=new FeedItem();
post.ParentID='0F9280000000B0t';
post.createdbyID=UserInfo.getuserId();
post.Body='Good Morning';
insert post;
}
global void finish (Database.BatchableContext BC)
{
}
}