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
Sara JawedSara Jawed 

Apex Errors while validating changeset to production.

Hi All,
Can anyone help me in understanding the following apex errors occurring while a validate my changeset in production:

1. System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, Use one of these records?Stack Trace: Class.unsubscribe.testUnsubscribe: line 110, column 1 
2. System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION, Use one of these records?Stack Trace: Class.unsubscribe.testUnsubscribe2: line 141, column 1 

The apex errors are occurring in the Apex class "unsubscribe". A warning message is also displayed indicating code coverage failure. 
Very new to Salesforce and trying to help the charity iam volunteering for to deploy some changes to production. 
Any help would be greatly appreciated.
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sara,

These should be test classes failures. Can you fix these test classes and try to deploy them again. If you are running all tests while deploying then the overall code coverage should be atlest 75%. Salesforce does not allow to deploy if the code coverage is less than 75%.

Please find the below article for more details.

https://developer.salesforce.com/docs/atlas.en-us.232.0.apexcode.meta/apexcode/apex_code_coverage_best_pract.htm

If this solution helps, Please mark it as best answer.

Thanks,
 
Sara JawedSara Jawed
Hi Sai,
Thank you for the reply. The issue is I do not know apex as I am not a Salesforce Developer. From what I've understood is that this apex class "unsubscribe" is part of a managed package called " unsubscribe opt-out" installed by a former colleague. The charity is currently using Mailchimp to unsubscribe customers. My question is how do I fix this Apex test class error?. 
Can I uninstall the managed package since all unsubscriptions are being handled by Mailchimp? or is there another way to solve this?
Sorry if that's a silly question to ask, but I am very new to Salesforce and even more to Apex.

Thanks
Cynthia SottileCynthia Sottile
Thank you for the reply. The issue is I do not know apex as I am not a Salesforce Developer. From what I've understood is that this apex class "unsubscribe" is part of a managed package called " unsubscribe opt-out" installed by a former colleague. The charity is currently using Mailchimp to unsubscribe customers. My question is how do I fix this Apex test class error?. 
Can I uninstall the managed package since all unsubscriptions are being handled by Mailchimp? or is there another way to solve this?
Sorry if that's a silly question to ask, but I am very new to Salesforce and even more to Apex.
For more info about Apex error  visit these web
Spectrum Speed Test (https://spectrumspeed.org/)
speed test (https://tgpspeed.xyz/)
poslaju tracking express (https://poslaju.xyz)
 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Sara,

We can use run local tests or run specified tests . Run local tests wont run the test classes from the managed package. I hope this should solve your issue. 

Please find the below article for more details on each.

https://www.greytrix.com/blogs/salesforce/2016/09/07/deployment-options-for-changeset/

If this solution helps, Please mark it as best answer.

Thanks,