+ Start a Discussion
cl0s3rcl0s3r 

When attempting to deploy trigger into Production I get, "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY"

The trigger and testclass work fine in the sandbox with 100% code coverage.  Has anyone else ran up against this type of issue?

trigger AccountOrgUpdate on Account (before insert) {
		//Organization Type
		//TrackerOrgType
		Account ac = trigger.new[0];
		//if (ac.TrackerOrgType__c != null){
			String acc = ac.Organization_Type__c;
			String[] s = ac.Organization_Type__c.split(';');
			System.debug('Alerting on ----> Organization Type '+acc);
			System.debug('Alerting on ----> String Array '+ s);
			for(Integer i=0;i<s.size();i++){
				if(!s[i].contains(ac.TrackerOrgType__c)){
					ac.Organization_Type__c = acc +';'+ac.TrackerOrgType__c;
					Boolean boo = true;
					System.debug('<----Alerting on Boo----> '+boo);
/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * Unit tests are class methods that verify whether a particular piece
 * of code is working properly. Unit test methods take no arguments,
 * commit no data to the database, and are flagged with the testMethod
 * keyword in the method definition.
 *
 * All test methods in an organization are executed whenever Apex code is deployed
 * to a production organization to confirm correctness, ensure code
 * coverage, and prevent regressions. All Apex classes are
 * required to have at least 75% code coverage in order to be deployed
 * to a production organization. In addition, all triggers must have some code coverage.
 * 
 * The @isTest class annotation indicates this class only contains test
 * methods. Classes defined with the @isTest annotation do not count against
 * the organization size limit for all Apex scripts.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */
@isTest
private class TestAccountOrgUpdate {

    static testMethod void myUnitTest() {
        // TO DO: implement unit test
        
//        Profile p = [Select id from Profile where name = 'Standard user'];
//        User u = new User(alias = 'Test123', email='test123@noemail.com', profileid = p.Id, country='United States',username='test123@noemail.com');
//        insert u;
        
        Account a = new Account(
        Name = 'Test Account',
//        OwnerId = u.Id,
        Organization_Type__c=('Ambulatory Surgical Center;Ancillary System Vendor'),
        TrackerOrgType__c ='Killer' );
        insert a;
    }
}

 

System.debug('<----Alerting on Organization Type----> '+ ac.Organization_Type__c);
//				if(s[i] != ac.TrackerOrgType__c){
//			System.debug('Alerting on ----> Tracker Organization Type '+ac.TrackerOrgType__c);
//			ac.Organization_Type__c = acc +';'+ac.TrackerOrgType__c;
//				}
				}
			 //ac.Organization_Type__c = ac.TrackerOrgType__c;
			
 }
}

 

Shashikant SharmaShashikant Sharma

Could you check the profile right of user that you are working with in production , compare profile rights for thsi profile with sandbox.

 

See this also :

http://kb.omni-ts.com/entry/68/

cl0s3rcl0s3r

This is ocurring on the Administrator profile and I have verified that the profile matches in the Sandbox to the Production access.