You need to sign in to do that
Don't have an account?
manav_mnv
I want to create a scheduler in Apex, in which i need to make 3 callouts. Can anybody please help me how to achieve this. Thanks
global class TourSyncBatch implements Database.Batchable<sObject>, Database.AllowsCallouts {
public static string invokeUrl{get; set;}
public static Map<String, Service_Endpoints__c> services {get; set;}
public Database.QueryLocator start(Database.BatchableContext bc){
//first callout to just invoke external service
services = Service_Endpoints__c.getAll();
invokeUrl = services.get('RefreshComms').Endpoint_URL__c;
if(!test.isRunningTest())
{
// Invoke the URL
HTTPWebCalloutUtil.HTTPWebCalloutGetRequest(invokeUrl);
}
return Database.getQueryLocator('select id, Tour_Reference__c, TourCreationStatus__c from Tour_Shell__c');
}
public void execute(Database.BatchableContext BC, List<Tour_Shell__c> Tourshell){
// need to invoke two services here, on basis of some condition, how to achive that
}
public void finish(Database.BatchableContext info){
}
}
Please help !!
Thanks in advance.
Regards,
Manav
public static string invokeUrl{get; set;}
public static Map<String, Service_Endpoints__c> services {get; set;}
public Database.QueryLocator start(Database.BatchableContext bc){
//first callout to just invoke external service
services = Service_Endpoints__c.getAll();
invokeUrl = services.get('RefreshComms').Endpoint_URL__c;
if(!test.isRunningTest())
{
// Invoke the URL
HTTPWebCalloutUtil.HTTPWebCalloutGetRequest(invokeUrl);
}
return Database.getQueryLocator('select id, Tour_Reference__c, TourCreationStatus__c from Tour_Shell__c');
}
public void execute(Database.BatchableContext BC, List<Tour_Shell__c> Tourshell){
// need to invoke two services here, on basis of some condition, how to achive that
}
public void finish(Database.BatchableContext info){
}
}
Please help !!
Thanks in advance.
Regards,
Manav
2. please provide more details on what you are trying to invoke that would helpus to help u
ACtually the scenario is, I will make the first callout to ESB, that will in return give me list of Failed records which is unable to sync in SF.
They will return single parameter(Tour number) in json format.
So after that by using that Tour numbers(provided by ESB), i will make another callout to sync that tours.
Note: Everything is done by ESB, I just need to invoke the external services.
IN my code, I am using custom setting to invoke the url, that is already built.
Just need help in Batch class and Scheduler.
Thanks.