function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
@rajeshdulhai@rajeshdulhai 

Regarding Scheduled job

Hi everyone ,

 

i want to execute a scheduled job of sending sms . i am confused  in the code

 

my scheduled job code is as follows ,

 

global class TwilioSchedule_Weekly_SMS Implements Schedulable{
     global void Execute(SchedulableContext SC)
     {
          ScheduledSMS();
     }
     @future (callout=true) //code that does HTTP callouts
     static void ScheduledSMS(){
     
     QueryResult qResult = null;
     String soqlQuery = ' SELECT  Id ,Mobile__c  FROM Account WHERE Weekly_Scheduled_SMS__c = true ';
     qResult = connection.query(soqlQuery);
    
     TwilioMessageController obj = new  TwilioMessageController();
     obj.messageType = 'SMS ';
     obj.messageBody = ' test test ';
     obj.onSend();
     }
}

 

i want to select all the mobile nos from the above query and send SMS to all those numbers with the message body "test tes " . help me out in the code

 

Thanks ,

Rajesh

 

hitesh90hitesh90

Hi rajesh,

 

you have to use system.schedule() method to scheduled job of sending sms.

 

see below example:

Schedule Apex to run Every 24 HOUR

 

For more information about scheduler go to below link:

Apex Scheduler

 

Important :
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator & Advanced Administrator & Sales cloud consultant
My Blog:- http://mrjavascript.blogspot.in/

@rajeshdulhai@rajeshdulhai

Thanks Hitesh Patel and Subra.J

Rajesh