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
rob3000rob3000 

Need help to deploy trigger from sand to prod!

HI Community,

 

I want to update the Case_Before_Update trigger. Actually all I want to do is comment the two method calls in its body out and have it look like this:

 

trigger Case_Before_Update on Case (before update) {

/**    CaseTriggers.setAccOwnerCustFieldOnCase(Trigger.new); 
    CaseTriggers.assignAccountManager(Trigger.new);  */
}

 

 

When I try to deply this trigger I the following error messages: 

 

 

API NameTypeLineColumnProblem
CampaignCheckAttachmentController.testCampaignCheckAttcmnt()Class3201Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []", Failure Stack Trace: "Class.CampaignCheckAttachmentController.testCampaignCheckAttcmnt: line 320, column 1"
CampaignTriggers.testCampaignCheckAttcmnt()Class1971Failure Message: "System.QueryException: List has no rows for assignment to SObject", Failure Stack Trace: "Class.CampaignTriggers.testCampaignCheckAttcmnt: line 197, column 1"
CampaignTriggers.testContactsNullify()Class891Failure Message: "System.QueryException: List has no rows for assignment to SObject", Failure Stack Trace: "Class.CampaignTriggers.removeGroupMember: line 89, column 1"
CaseTriggers.testAssignAccountManagerAccOwner()Class5541Failure Message: "System.AssertException: Assertion Failed: Expected: 00520000002BggnAAC, Actual: 00520000002BggoAAC", Failure Stack Trace: "Class.CaseTriggers.testAssignAccountManagerAccOwner: line 554, column 1"
MyProfilePageController.testSave()Class821Failure Message: "System.TypeException: System.runAs can only be used with an active user", Failure Stack Trace: "Class.MyProfilePageController.testSave: line 82, column 1"
Deploy Error   Average test coverage across all Apex Classes and Triggers is 70%, at least 75% test coverage is required.

 

 

I don't understand what these problems have to do with my Case trigger? This is all about Campaigns etc which have nothing to do with Cases. I just want to comment out some things and not touch all the other classes.... Any advise appreciated!

 

 

craigmhcraigmh

When you deploy to Production, it runs all tests in the Organization, not just the ones for your change set.  Many times, I've had to yell at clients to fix their test classes so that I could deploy a change set.

rob3000rob3000

What is the purpose of these test classes; and is there any risk in just commenting them out?

Thanks

craigmhcraigmh

They are there to test other pieces of code that have been deployed to production.

 

And yes, commenting them out is a bad idea since it might bring your organization's code coverage below 75%, which is not allowed.