[英]How can i bulk update Accounts in Salesforce?
I am trying to update the Description for over 200 Account entities by matching on Salesforce Id.我正在尝试通过匹配 Salesforce Id 来更新 200 多个帐户实体的描述。 I am using the following trigger,我正在使用以下触发器,
Trigger MyNew_tr_U on Account (after update) {
set<ID> ids = Trigger.newMap.keyset();
for(ID id : ids)
{
newChangeTable__c ch = new newChangeTable__c();
ch.Status__c = 'update';
ch.Url__c = id;
ch.Process__c = false;
insert ch;
}
} }
but when i do the data Import of the csv file i get the following error:但是当我对 csv 文件进行数据导入时,出现以下错误:
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:MyNew_tr_U: execution of AfterUpdate
caused by: System.DmlException: Insert failed. First exception on row 0; first error:
STORAGE_LIMIT_EXCEEDED, storage limit exceeded: []
How can i get the trigger to work?我怎样才能让触发器工作?
Further to @eyescream answer below.进一步到下面的@eyescream 答案。 What if I have no filter as in Name, that gives the same error.如果我没有 Name 中的过滤器怎么办,那会产生相同的错误。
Trigger MyNew_tr_U on Account (after update) { List<newChangeTable__c> toInsert = new List<newChangeTable__c>();在帐户上触发 MyNew_tr_U(更新后){ List<newChangeTable__c> toInsert = new List<newChangeTable__c>();
for(Account a : trigger.new){
Account old = trigger.oldMap.get(a.Id);
toInsert.add(new newChangeTable__c(
Status__c = 'update',
Url__c = a.Id,
Process__c = false
));
}
insert toInsert;
} }
You're running out of database space.您的数据库空间不足。 Go to Setup -> Storage Usage and have a look. Go 到 Setup -> Storage Usage 看看。 Maybe you can delete something, maybe (if it's production) you can buy more storage from SF (there are "data packs" 10 GB each or you get some more storage with every user license you buy).也许你可以删除一些东西,也许(如果它是生产)你可以从 SF 购买更多的存储空间(有每个 10 GB 的“数据包”,或者你购买的每个用户许可证都会获得更多的存储空间)。 That works only in productions, sandboxes have fixed size though so your only way is to delete some old stuff.这只适用于制作,沙箱有固定的大小,所以你唯一的方法是删除一些旧的东西。
As for the trigger itself...至于触发器本身......
Something like this, it inserts your thing only if Name changed.像这样,只有当名称改变时它才会插入你的东西。
Trigger MyNew_tr_U on Account (after update) {
List<newChangeTable__c> toInsert = new List<newChangeTable__c>();
for(Account a : trigger.new){
Account old = trigger.oldMap.get(a.Id);
if(a.Name != old.Name){
toInsert.add(new newChangeTable__c(
Status__c = 'update',
Url__c = a.Id,
Process__c = false
));
}
}
insert toInsert;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.