TransWikia.com

Test Class Error - CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

Salesforce Asked on November 30, 2021

I am getting this error message and can’t seem to figure out what is causing it. I have a test class where I am creating a new Task record. In my sandbox the test class passes fine, but in production during deployment I get this error:

"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TaskAction: data changed by trigger for field Task Record Type ID: value not valid for the entity: Task: []
"

 Task newTask = new Task();
 newTask.Subject = 'Test Task';
 newTask.WhatId = opp.Id;
 newTask.WhoId = con.Id;
 newTask.Status = 'Open';
 newTask.Priority = 'High';
 newTask.Type = 'Call';

 insert newTask;

The variables opp.Id and con.Id are the IDs after inserting dummy contact and opportunity records that part of the dummy data set used in my test class.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP