I have a trigger and an apex class, When i deploy them from staging to production I get the following error. What Should i do ? I have a week experience in salesfroce.


Code Coverage Failure Your organization's code coverage is 71%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage. AccountCallout

Code Trigger

trigger AccountCallout on Account (after update) {
    for (Account a : Trigger.new) {
        // make the asynchronous web service callout

           a.Email__c, a.BillingStreet,a.Country_of_Headquarters__c,
           a.Any_other_questions_of_operation__c, a.Website, a.Year_of_formation__c,
           a.Legal_Status__c,a.Legal_Status_Other__c, a.Mission_Statement__c,
           a.Mission_Statement_Other__c, a.Sector_of_Operation__c, a.Sector_Other__c,
           a.What_does_this_Enterprise_do__c, a.Parent_Company_C__c, a.NumberOfEmployees,
           a.How_did_you_hear_about_Connect__c, a.Why_interested_in_Connect_programme__c, a.Innovative_idea__c,
           a.Benefits_of_your_innovation__c, a.Seeking_a_partner_Requirements__c, a.Any_other_info__c,
           a.Value_enterprise_provides__c, a.Improve_health_or_agri_food_prospects__c,
           a.Opportunities_to_improve_diversify_grow__c );        
  • If you can hust point me in the right direction Feb 10, 2016 at 10:41
  • You are calling out in for loop. You should make the trigger bulkified.
    – Ashwani
    Feb 10, 2016 at 10:51
  • 1
    What have you tried? Do you have test classes? If so, post them in your question. If not, write them. If it still doesn't work - post a question asking what you want and showing us what you tried. SFSE is a Q&A site where you can find help if you also show some effort you did yourself.
    – Novarg
    Feb 10, 2016 at 13:06
  • @Novarg : Duly Noted sir, thanks for the info. I had no idea regarding test classes before today. So i was just looking for a way to write test classes. Feb 10, 2016 at 13:24
  • 1
    tushar, I suggest you go to the Trailhead Modules and locate the Test Class module to learn how to write them properly. There's also a module on Triggers. In your case, also look at the documentation on making Mock callouts.
    – crmprogdev
    Feb 10, 2016 at 13:47

1 Answer 1


Yes as mentioned your code coverage should be greater than 75% to deploy.

  1. Create appropriate test class for this trigger
  2. In the test class make sure to update the Account object at-least once


And also its good to keep in mind the best practices:



Simplest test which would cover your trigger would be:

  private class AccountCalloutTest {
      static testMethod void validateCallout() {
         Account acc = new Account(Name='Test Account');
         insert acc;
         update acc;


The above test just takes your test coverage up. If you are really interested in testing the whole functionality I would recommend doing real System.assert to validate the behavior of your artifact.

  • 1
    I think it's #1 he needs help with :)
    – mkorman
    Feb 10, 2016 at 12:01
  • What will be the shortest test class example Feb 10, 2016 at 13:31
  • mkorman sure, I was thinking he needs pointers to proceed. @tushar I updated the answer with a sample test. Feb 10, 2016 at 14:57
  • @karthikselva I get the following error after writing your test case : esttrigger validateCallout System.NullPointerException: null argument for JSONGenerator.writeStringField() Stack Trace: Class.System.JSONGenerator.writeStringField: line 178, column 1 Class.WebServiceCallout.sendNotification: line 27, column 1 Feb 11, 2016 at 4:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .