0

オブジェクトからレコードを取得してから、(のフィールドの一部の)レコードを別のオブジェクトに挿入したいアプリケーションを開発しています。以下は、オブジェクトが入力されておらず、新しいレコードが表示されない理由を理解できない私のコードです。

//スケジューラ関連のクラス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);
}
}

//バッチ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){
    }
}

//バッチApex関連クラス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;
}   
}

誰かがそれを見ることができればお願いします。また、誰かが私のbuild.xmlまたはpackage.xmlを見たい場合は、教えてください..ありがとう

4

1 に答える 1

1

スケジュールされたバッチジョブを実行しているため、すべての実行がシステムによって監視されます。セットアップ-管理セットアップ-監視-apexジョブのエラーを確認してください。別のデバッグオプションは、(EclipseまたはUIで)匿名実行を使用してジョブを手動で実行し、ログを確認することです。

于 2012-06-25T19:28:01.050 に答える