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
jbroquistjbroquist 

After Insert/Update triggers broken

I've been using the following trigger in production for about 5 months with no issues and all of a sudden today I'm getting the following errors:

 

Apex script unhandled trigger exception by user/organization: DeploymentOrderIsVerified: execution of AfterUpdate caused by: System.ListException: List index out of bounds: 0 Trigger.DeploymentOrderIsVerified: line 10, column 41

 The code block the error is referring too is as follows:

 

/**
* Fires when the Deployment Order IsVerfied flag is set to true.
* Child Lease Field Updates:
* -IsVerified__c = TRUE
* -NextStep__c = 'Awaiting Funding'
*/
trigger DeploymentOrderIsVerified on DeploymentOrder__c (after insert, after update)
{
DeploymentOrder__c olddo;
DeploymentOrder__c newdo = Trigger.new[0];

 

 How would I get a ListException error referencing the first item in Trigger.new on an after insert/after update trigger?

 

 

Best Answer chosen by Admin (Salesforce Developers) 
jbroquistjbroquist

Turns out another admin added a lookup filter to one of our fields which was generating an error on save. For whatever reason that wasn't showing in the debug logs though ... really odd.

 

Either way the trigger is firing properly again ... Thanks for the help ...

All Answers

TehNrdTehNrd

Yup, that is bizzare. It seems like this shouldn't be possible. If the list trigger.new is trully empty the trigger should have never fired as there was nothing to fire it. Do you get this error everytime? Only inserts, only updates?

 

I'm curious what this outputs:

 

 

system.debug(trigger.new.size());

I would open a case on this one though.

 

 

jbroquistjbroquist
It's happening on both inserts and updates nows ... setting up fresh sandbox to do some debugging ... will get back to you with the trace results of what Trigger.new and Trigger.new.size() output ...
jbroquistjbroquist

Turns out another admin added a lookup filter to one of our fields which was generating an error on save. For whatever reason that wasn't showing in the debug logs though ... really odd.

 

Either way the trigger is firing properly again ... Thanks for the help ...

This was selected as the best answer