当我从apex页面调用createCurrencies()方法as action =“{!createCurrencies}”时,以下代码正常工作 但是当我安排它时,它无法正常工作。
你知道可能出现什么问题吗?
global class DailyExchangeRates implements Database.Batchable<sObject>, Schedulable {
global Database.QueryLocator start(Database.BatchableContext BC){return null;}
global void execute(Database.BatchableContext BC, list<sObject> scope){}
global void finish(Database.BatchableContext BC){}
global void execute(SchedulableContext SC) {
createCurrencies();
}
public void createCurrencies(){
if(getRate(eur, fb).length() <= 6 && getRate(eur, fb).length() > 0){
Double EurTl = Double.valueOf(getRate(eur, fb));
Double GbpTl = Double.valueOf(getRate(gbp, fb));
Double UsdTl = Double.valueOf(getRate(usd, fb));
Double RubTl = Double.valueOf(getRate(rub, fb));
insert new Currency__c(
Conversion_Rate__c = EurTl,
Currency_Date__c = effectiveDate,
Published_Date__c = getTcmbDate(),
Exchange_Type__c = 'EURMA'
);
insert new Currency__c(
Conversion_Rate__c = GbpTl,
Currency_Date__c = effectiveDate,
Published_Date__c = getTcmbDate(),
Exchange_Type__c = 'GBPMA'
);
insert new Currency__c(
Conversion_Rate__c = UsdTl,
Currency_Date__c = effectiveDate,
Published_Date__c = getTcmbDate(),
Exchange_Type__c = 'USDMA'
);
insert new Currency__c(
Conversion_Rate__c = RubTl,
Currency_Date__c = effectiveDate,
Published_Date__c = getTcmbDate(),
Exchange_Type__c = 'RUBMA'
);
}
}
}