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
VictorBVVictorBV 

Error during deploying in test class that haven not been modified

I am trying to deploy some changes I have done in one trigger and in a test class (for testing that trigger), and I receivede this error during deploying.

 

Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, tareaToEvento_AI: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Event_AI: execution of AfterIns...

 

It happens in a test class which hasn't been modified.

 

Why is this happening?

How can I solve it?

 

Thanks very much

bob_buzzardbob_buzzard

While the test class hasn't been modified, does your trigger get invoked when the test class is run, and has your trigger changed the behaviour?

 

If you run all tests in your dev org/sandbox, does the same error occur?

VictorBVVictorBV

Yes, my trigger is invoked when that test class is run but not in the line the eception is thrown.

 

When I run all tests there is no error.

 

 

bob_buzzardbob_buzzard

That sounds like live data is interfering with your test case then, if it only happens when deploying to production.

 

You'll have to fix the test though, as otherwise you won't be able to deploy your code.

VictorBVVictorBV

But I dont understand the meaning of the error I get.

 

I read that error means 

 

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

You do not have permission to create, update, or activate the specified record.

 

But I am System Administrator, how could be that possible?

 

Thanks

 


 

bob_buzzardbob_buzzard

Is there any other information in the exception - i.e. is the DML failing due to a validation rule or similar?

VictorBVVictorBV

I dont get more informatión from deploying error message.

 

Could I get more information somehow?

 

Thanks

bob_buzzardbob_buzzard

I've seen other threads that suggest this may be related to the number of records in the system too.

bob_buzzardbob_buzzard

Can you post the code that is throwing the error.

VictorBVVictorBV

Error is thrown when new Task in inserted.   

   

Task llamada = new Task(WhatId=c.id, Description='Adicional para:  \n Cc: \n Cco: \n Archivo adjunto: \n \n Asunto: Asunto prueba \n Cuerpo: \n ',   duracion__c=15, Tipo__c='Desarrollo',                       Subject = 'Llamada'                );

 

insert llamada;

 

It, of course, cause triggers to be executed. On of them is called tareaToEvento_AI.

 

The name of that trigger appears on error message, but I dont know if the erros is there, since I dont get that information from deploying message.

bob_buzzardbob_buzzard

If you run all the tests in production do you get the error?

VictorBVVictorBV

No.

 

If I run all tests everything works with no error

bob_buzzardbob_buzzard

Hmm.  Sorry, can't think of much else to suggest.  You might try turning on debug logging for the user that you are deploying as.  That's helped me with managed packages in the past.