Cloud 应用程序已使用Ant(迁移工具)部署,但无法运行
我正在开发一个应用程序,在这个应用程序中,我从一个对象中检索记录,然后希望将记录(的一些字段)插入到不同的对象中。下面是我的代码,在其中我无法理解为什么我的对象没有被填充,并且无法看到新记录 //与调度程序相关的类1Cloud 应用程序已使用Ant(迁移工具)部署,但无法运行,cloud,salesforce,apex-code,Cloud,Salesforce,Apex Code,我正在开发一个应用程序,在这个应用程序中,我从一个对象中检索记录,然后希望将记录(的一些字段)插入到不同的对象中。下面是我的代码,在其中我无法理解为什么我的对象没有被填充,并且无法看到新记录 //与调度程序相关的类1 public with sharing class ScheduleBatchLauncher{ public static String scheduleBatch(Datetime batchTime){ CreateAndModifyScheduler batchSc
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;
}
}
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 CreateAndModifyScheduler implements Schedulable{
global void execute(SchedulableContext sc) {
CreateAndModify scBatch = new CreateAndModify();
database.executebatch(scBatch);
}
}
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;
}
}
//第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;
}
}
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){
}
}
如果有人能看一下,请。另外,如果有人想查看my build.xml或package.xml,请告诉..谢谢您正在运行一个计划的批处理作业,因此系统会监控每次执行。检查setup-administration setup-monitoring-apex作业是否存在错误。
另一个调试选项是使用execute anonymous(在eclipse或ui中)手动执行作业并检查日志。您是说代码已成功部署,但在执行时未能产生所需的结果,或者使用迁移工具的部署失败了吗?使用迁移工具的部署似乎成功了,因为ant deploy命令输出“Build Successfully”。salesforce.com上的monitor deployment页面也显示状态为completed,但组件为零。因此,我认为部署是成功的,但在执行时未能产生预期的结果。如果Monitor Deployments页面显示0个组件,则听起来不像是在部署您的类。您可以在生产环境中查看类吗?可以。在设置->开发->顶点类中。我可以看到我的四个类的状态都是“活动”和“检查”的。它也成功地编译了。通过编写代码的方法,我使用了开发人员控制台。我刚刚读到,为了成功部署,测试覆盖率应该至少为75%,所以这可能是没有看到所需输出的原因吗??