问题描述
我正在尝试在我的生产 Salesforce 环境中为学生注册触发器部署和入站更改集,但由于不相关的测试类而失败。错误如下:
System.EmailException:SendEmail 失败。第 0 行的第一个异常;第一个错误:INSUFFICIENT_ACCESS_OR_READONLY,未配置访问此组织范围的电子邮件地址:[] 堆栈跟踪:Class.TrainerReportEmailer.sendReports:第 79 行,第 1 列 Class.TrainerReportEmailer.execute:第 22 行,第 1 列 Class.TestTrainertextReportEmailer.sendReports 85,第1列
我已更新引用的组织范围电子邮件地址,确保将地址设置为“允许所有配置文件”,并且我已检查关联用户的访问/权限,但错误仍然存在。以下是我的测试类特定于错误中报告的行的代码:
第 11-22 行:
static void init() {
contactList = new List<Contact>();
courseList = new List<Course__c>();
contactList.add(new Contact(
FirstName = '.....',LastName = '.....',Email = '.............',Contact_Type__c = 'Certified',drupal_password_reset_link__c='https://www.valuescentre.com/myctt/password'
));
第 55-80 行:
insert opList;
opList = [select Name,StageName,Drupal_Id__c,Consultant__c,CloseDate from Opportunity where id=:opList[0].Id];
studentIdList = new List<Id>();
srList = new List<Student_Registration__c>();
srList.add(new Student_Registration__c (
status__c = 'Certified',certified_date__c = System.today().addMonths(-1),Student__c = contactList[0].Id,cert__c = 'Part 1',Course_Opportunity__c = opList[0].Id,Course__c = courseList[0].Id
));
insert srList;
srList = [Select Student__r.Id,cert__c,certified_date__c,course__r.name,Course_Opportunity__r.name,Course_Opportunity__r.Trainer_Instructor__c from Student_Registration__c where status__c='Certified' and certified_date__c != null and certified_date__c > :Date.today().addDays(-365)];
for(Student_Registration__c sr : srList) {
System.debug('sr ' + sr.Student__r.Id);
studentIdList.add(sr.Student__r.Id);
}
contactsCertifiedThisYear = [Select Id,Name,Email,Part_Two_Free_Assessment_Date__c,Part_One_Free_Assessment_Date__c,Part_One_Trained_By__c,Part_One_Trained_By__r.name,Part_Two_Trained_By__c,Part_Two_Trained_By__r.name,Part_One_Cert_Date__c,Part_Two_Cert_Date__c,Part_One_Course__r.name,Part_Two_Course__r.name,First_Paid_Assessment_Date__c,(Select cert__c,Course_Opportunity__r.Trainer_Instructor__c,isRetake__c from Student_Registration__r where status__c='Certified') from Contact where id in :studentIdList order by Part_Two_Cert_Date__c,Part_One_Cert_Date__C desc];
}
第 81-88 行:
static testMethod void textExecute() {
Test.starttest();
init();
TrainerReportEmailer tMailer = new TrainerReportEmailer();
tMailer.execute(null);
Test.stoptest();
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)