You need to sign in to do that
Don't have an account?
Ajay Kumar 261
Bulk update: Before Trigger is not firing for all the records.
Hi,
I have a method which will update a field on contact record. As you can see the code below, this method runs on before trugger on contact and then it will update the Merchant Score field. It is is working fine when I update in the UI. However it is not working when I do the bulk update using dataloader and informatica load. it is updating only few records.
Scenario1: I tried updating 209 records without bulk API, and it worked only for 193 records.
Scenario2: I tried updating 100 records with bulk API, and all of them are success.
Scenario3: I tried updating 150 records with bulk API, and all of them are success.
Scenario4: I tried with 200 records with bulk API, however only 100 got updated.
There is no consistency in the output. Can anyone help me to resolve this?
public static void contactMSScoreUpdate(List<Contact> ContactTriggerList,Map<Id,Contact> OldContactTriggerMap){
for(Contact c : ContactTriggerList){
Contact con= OldContactTriggerMap.get(c.Id);
if(c.Score_Merchant__c != null&&c.Score_Merchant__c!=con.Score_Merchant__c&&c.score_profile__c!=null){
c.Score_Merchant__c = c.score_profile__c+c.Score_Merchant__c.right(1);
system.debug(' c.Score_Merchant__c '+ c.Score_Merchant__c );
}
}
}
Regards,
Ajay
I have a method which will update a field on contact record. As you can see the code below, this method runs on before trugger on contact and then it will update the Merchant Score field. It is is working fine when I update in the UI. However it is not working when I do the bulk update using dataloader and informatica load. it is updating only few records.
Scenario1: I tried updating 209 records without bulk API, and it worked only for 193 records.
Scenario2: I tried updating 100 records with bulk API, and all of them are success.
Scenario3: I tried updating 150 records with bulk API, and all of them are success.
Scenario4: I tried with 200 records with bulk API, however only 100 got updated.
There is no consistency in the output. Can anyone help me to resolve this?
public static void contactMSScoreUpdate(List<Contact> ContactTriggerList,Map<Id,Contact> OldContactTriggerMap){
for(Contact c : ContactTriggerList){
Contact con= OldContactTriggerMap.get(c.Id);
if(c.Score_Merchant__c != null&&c.Score_Merchant__c!=con.Score_Merchant__c&&c.score_profile__c!=null){
c.Score_Merchant__c = c.score_profile__c+c.Score_Merchant__c.right(1);
system.debug(' c.Score_Merchant__c '+ c.Score_Merchant__c );
}
}
}
Regards,
Ajay
Regards,
Ajay
All Answers
Your code looks good to me. Are you sure that all of the data inserted will pass the below condition -
Regards,
Ajay