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
PronowPronow 

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); 
     OnProjectUpdate.updateVolunteerFields(Trigger.new);   
}
}

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.
bob_buzzardbob_buzzard
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:

https://developer.salesforce.com/forums/ForumsMain?id=906F00000008zF5IAI

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

That helped me.