【发布时间】:2017-05-30 12:32:23
【问题描述】:
我正在尝试为 Account 对象上的插入事件之前编写触发器。
trigger DeduplicationAccount on Account (before insert) {
//Get all the accounts in action in 'insert'
Account[] inputAccountList = Trigger.NEW;
我正在尝试在我的输入帐户列表中获取相对的帐户列表。 举例来说,我正在尝试在我的触发器中获取姓氏 = 'XXX' 的帐户 new。
所以,我是这样写的: // 这里,listOfSurname 包含一个带有 'XXX' 的姓氏列表
for(Account ac: Trigger.new){
List<Account> accountDuplicate = [Select ac.rr_First_Name__c, ac.rr_Last_Name__c From
Account ac where ac.rr_Last_Name__c IN : listOfSurname];
System.debug('accountDuplicate: '+ accountDuplicate);
}
但是,尽管我输入了这个列表,但该列表始终为 0,一个帐户的姓氏为“XXX”。
【问题讨论】:
标签: list triggers salesforce apex