You need to sign in to do that
Don't have an account?
Ivan Winzer
Emergency too many soql queries error
I have an emergency. I need to update over 50k records on our address object. I have a trigger that was working in sandbox but for some reason is now giving a too many soql query error in prod when i try to do a data load using data loader. Can anyone tell me what ive done wrong i thought i had it bulkfied already...
trigger mainShipToAddessTrigger on ShipTo_Address__c (before insert, before update) { List<ShipTo_Address__c> slist = new List<ShipTo_Address__c>(); List<Contact> contactsToUpdate = new List<Contact>(); for ( ShipTo_Address__c s : trigger.new ) { if ( s.Primary_Billing_Address__c == true) { Contact c = New Contact(Id = s.Contact__c); system.debug('***** UPDATING:'+c.Id+' '+s.Address__c+' '+s.City__c); // Address1_2 = String.Valueof(s.Address__c) + String.ValueOf(' ') + String.Valueof(s.Address2__c); c.MailingStreet = String.Valueof(s.Address__c) + String.ValueOf(' ') + String.Valueof(s.Address2__c); c.MailingCity = s.City__c; c.MailingState = s.State__c; c.MailingCountry = s.Country__c; c.MailingPostalCode = s.ZIP__c; contactsToUpdate.add(c); // update c; } if ( s.Default_Shipping_Address__c == true) { Contact c = New Contact(Id = s.Contact__c); system.debug('***** UPDATING:'+c.Id+' '+s.Address__c+' '+s.City__c); c.OtherStreet = String.Valueof(s.Address__c) + String.ValueOf(' ') + String.Valueof(s.Address2__c); c.OtherCity = s.City__c; c.OtherState = s.State__c; c.OtherCountry = s.Country__c; c.OtherPostalCode = s.ZIP__c; contactsToUpdate.add(c); // update c; } update contactsToUpdate; } }
All Answers
Ivan
Something like that.