2012-06-01 20 views
0

我正在開發一個應用程序,其中我從對象中檢索記錄,然後希望將(記錄的某些字段)插入到不同的對象中。下面是我的代碼,其中我無法弄清楚爲什麼我的對象沒有被填充,並且無法看到新記錄。使用Ant部署的應用程序(遷移工具)但不起作用

//調度相關的類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,請告訴..謝謝

+0

您是否說過代碼已成功部署,但是在執行時未能產生所需的結果,或者使用遷移工具部署失敗? – JCD

+0

使用遷移工具進行的部署似乎是成功的,因爲ant deploy命令輸出「Build succesfully」。 salesforce.com上的監視器部署頁面也顯示狀態已完成,但組件爲零。所以,我認爲部署是成功的,但它在執行時無法產生所需的結果。 – LivingThing

+0

聽起來好像您的類正在部署,如果Monitor Deployments頁面顯示0個組件。您是否能夠在生產環境中查看課程? – JCD

回答

1

您正在運行計劃的批處理作業,因此每個執行都由系統監視。檢查設置 - 管理設置 - 監控 - 作業錯誤。 另一個調試選項將使用執行匿名(在eclipse或ui中)手動執行您的作業並檢查日誌。

相關問題