+ Start a Discussion

Test RunAll error

Hello there,

I have this trigger,

trigger OnProjectUpdate on Project__c (after update, before update)
Triggers__c projectTrigger = Triggers__c.getInstance('OnProjectUpdate');
if( projectTrigger.Active__c )
     OnProjectUpdate.createFeedbackForVolunteer(Trigger.new, Trigger.old); 

Whenever, I do RunAll tests it gives error as follows:

System.DmlException: Insert Failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, these is already an item in this list with the name OnProjectUpdate: [name]

As I know this trigger is on UPDATE, it should not throw error on INSERT.

Please help.

Thanks in advance.
You are correct that this is an update trigger, but it invokes a method called createFeedbackForVolunteer, which sounds highly likely to try to insert a record in the database.

Based on this thread:


it looks like it might be an issue with custom settings.
Thanks Bob!

That helped me.