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
Mike FerraroMike Ferraro 

Time Based Workflow working fine in Sandbox, but won't deploy to Production

Hello!  I updated a Time Based Workflow that's working perfectly in Sandbox, but now won't deploy due to errors on the tests:

User-added image
Do I have to somehow update these tests in order for them to pass?

Thanks!

Mike
Mike FerraroMike Ferraro
Here are those errors in detail:

Test_CreateOpportunity:   System.DmlException: Update failed. First exception on row 0 with id 0013t00001UjIWeAAN; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateOpportunity: execution of BeforeUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 0013t00001UjIWe) is currently in trigger CreateOpportunity, therefore it cannot recursively update itself: [] Class.CreateOpportunityHelper.insertOpps: line 28, column 1 Trigger.CreateOpportunity: line 10, column 1: []
Stack Trace: Class.Test_CreateOpportunity.myOpportunityCreateUnitTest: line 8, column 1

Test_UpdateDummyAccountVariable:

System.DmlException: Update failed. First exception on row 0 with id 8003t000008Iqb3AAC; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateAccountDummyVariable: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0013t00001UjIWfAAN; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateOpportunity: execution of BeforeUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 0013t00001UjIWf) is currently in trigger CreateOpportunity, therefore it cannot recursively update itself: [] Class.CreateOpportunityHelper.insertOpps: line 28, column 1 Trigger.CreateOpportunity: line 10, column 1: [] Class.Upd
Stack Trace: Class.Test_UpdateAccountDummyVariable.updateDummyUnitTest: line 18, column 1
 
SFDC Apex DevSFDC Apex Dev
Hi Mike,

Check your class CreateOpportunityHelper at line 28 and update your test class based on the logic present.
May be it will help you out to correct the test class then only you would be able to deploy it in production.

Thanks!
Chirag