function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tdevmantdevman 

MD

hey guys..I have a before insert trigger on a OrderLineItem__c object which is the detail object. The master is Order__c. When it fires it should populate the sales_rep__c with the ownerid associated to the order.contact__c field.  This works with 1 record but when i do a bulk insert with data loader I get this issue. if anyone can help i would really appreciate and mark as solution

OrderLineItemsTrigger: execution of BeforeInsert caused by: System.ListException: List index out of bounds: 1 Class.MyUtilities.SalesRepAssign: line 11, column 1 Trigger.OrderLineItemsrigger: line 11, column 1

 

Sridhar BonagiriSridhar Bonagiri

Hi,

 

Can you please check the list size before iterating in the for loop.

 

Regards,

Sridhar Bonagiri