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
Ty WhitfieldTy Whitfield 

Can't Deploy Trigger Into Production

I have a Trigger and the associated Test Class  that I have set up in our sandbox. According to the Developer Console, I have a 95% coverage onmy trigger after running the Test Class.  However, when I try to deploy into production, I receive "Test coverage of selected Apex Trigger is 38.095%, at least 75% test coverage is required. 

Any idea as to why this is happening or has anyone else had this problem lately?

Suraj Tripathi 47Suraj Tripathi 47
Hi Ty,

1.Maybe any custom field or picklist value not present in production.
2.Have you use any restriction on trigger?? if yes then please true or false your restriction after insert or update in test class.
3.You can set debug log in production to find mistake or Exception.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Suraj
mukesh guptamukesh gupta
Hi Ty,

May be a reason:-

1.Should not use (SeeAllData = true) in Test class.
2. Updated trigger should be deploy.

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh