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

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Trigger: execution of AfterInsert

Hi guys,

i need some expert brain here to pin point me towards right direction.

i am getting this error when i "RUN ALL TESTS".  full detail of error as below

Error Message System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, trgOrphanId: execution of AfterInsert

caused by: System.QueryException: Record Currently Unavailable: The record you are attempting to edit, or one of its related records, is currently being modified by another user. Please try again.

Trigger.trgOrphanId: line 23, column 1: []
Stack Trace Class.testBulkAllocateOrphans.myUnitTest: line 33, column 1

the code coverage at the moment is 15%.
would appreciate any feedback.

Thanks in advacne.
Best Answer chosen by ArrgHunter
Finally found the solution for that problem. very simple.

I have to Disable Parallel Apex Testing from options and all sorted. Multiple tests were retrieving the data from same SObject.

thanks to Keith_C on StakeExchange (" target="_blank) .