• Shubham Gawande 5
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
public class ScheduleMessageBatch implements Database.Batchable<SObject>{
    
    
    public Database.queryLocator start(Database.BatchableContext BC)
    {
        return Database.getQueryLocator('Select Id, DeliveryStatus__c, Source__c, ScheduledAt__c, MessageText__c, ToNumber__c, FromNumber__c From MessageHistory__c where DeliveryStatus__c = \'Scheduled\' AND Source__c = \'Drip Campaign\' AND ScheduledAt__c <= Datetime.now()');
        
    }
    public void execute(Database.BatchableContext BC, List<MessageHistory__c> messagehistoryList )  {
        
        
        for(MessageHistory__c mh : messagehistoryList) {
            MessageDesk mD = new MessageDesk();
            MessageInfo mi = new MessageInfo(mh);
            mD.sendSMS(mi);
        }
        
    }
    public void finish(Database.BatchableContext BC)
    {
        
    }
}
public class ScheduleMessageBatch implements Database.Batchable<SObject>{
    
    
    public Database.queryLocator start(Database.BatchableContext BC)
    {
        return Database.getQueryLocator('Select Id, DeliveryStatus__c, Source__c, ScheduledAt__c, MessageText__c, ToNumber__c, FromNumber__c From MessageHistory__c where DeliveryStatus__c = \'Scheduled\' AND Source__c = \'Drip Campaign\' AND ScheduledAt__c <= Datetime.now()');
        
    }
    public void execute(Database.BatchableContext BC, List<MessageHistory__c> messagehistoryList )  {
        
        
        for(MessageHistory__c mh : messagehistoryList) {
            MessageDesk mD = new MessageDesk();
            MessageInfo mi = new MessageInfo(mh);
            mD.sendSMS(mi);
        }
        
    }
    public void finish(Database.BatchableContext BC)
    {
        
    }
}