我正在开发一个应用程序,其中我从对象中检索记录,然后想要将(某些字段)记录插入到不同的对象中。下面是我的代码,我无法弄清楚为什么我的对象没有被填充并且看不到新记录。
调度程序相关类 1
public with sharing class ScheduleBatchLauncher{
public static String scheduleBatch(Datetime batchTime){
CreateAndModifyScheduler batchSched = new CreateAndModifyScheduler();
String cron = '20 25 * * * ?';
String schedId = System.schedule('Create and Modify Batch 1', cron, batchSched);
return schedId;
}
}
调度程序相关类 2
global class CreateAndModifyScheduler implements Schedulable{
global void execute(SchedulableContext sc) {
CreateAndModify scBatch = new CreateAndModify();
database.executebatch(scBatch);
}
}
Batch Apex 相关类 1
global class CreateAndModify implements
Database.Batchable<sObject>, Database.Stateful{
global CreateAndModifyProcessor processor;
global CreateAndModify(){
this.processor = new CreateAndModifyProcessor();
}
global Database.queryLocator start
(Database.BatchableContext BC){
return Database.getQueryLocator([Select Agreement_ID__c, Begining__c,
Contact_Email__c, Contact_Name__c,
Country_Code__c, Currency__c,
Customer_Address__c, Customer_ID__c,
Customer_Name__c,Customer_Postal_Code__c,
Ending__c,Price__c FROM Unprocessed_Agreement__c]);
}
global void execute(
Database.BatchableContext BC,
List<sObject> listObj){
list <Account__c> inAcc = new list<Account__c>();
for (sObject lo : listObj){
Unprocessed_Agreement__c temp = (Unprocessed_Agreement__c)lo;
inAcc.add(processor.processAccountRecord(temp));
}
insert(inAcc);
update(inAcc)
}
global void finish(
Database.BatchableContext BC){
}
}
//批处理顶点相关类 2
global class CreateAndModifyProcessor {
global Account__c processAccountRecord( Unprocessed_Agreement__c temp){
Account__c tempAcc = new Account__c();
tempAcc.Customer_Name__c = temp.Customer_Name__c;
tempAcc.Customer_Address__c = temp.Customer_Address__c;
tempAcc.Postal_Code__c = temp.Customer_Postal_Code__c;
return tempAcc;
}
}
请问是否有人可以看看。另外,如果有人想看我的构建.xml或包.xml请告诉。谢谢
您正在运行计划的批处理作业,因此系统会监视每次执行。 检查设置 - 管理设置 - 监视 - 顶点作业是否存在错误。另一个调试选项是使用匿名执行(在 Eclipse 或 UI 中)手动执行作业并检查日志。