Salesforce.com Trigger

I am trying to build an integration from Salesforce.com to another data source. I would like to trigger it automatically from the Salesforce.com Case object when specific criteria is met. The below trigger is generated by the platform, but when I try to deploy this trigger, I get an error since there is a Code Coverage Error. Does anyone have any guidance on how to re-do this trigger to allow for the validation? 

 

1
2
3
4
trigger IntegratorIO on Case (after insert, after update) 
  {
  integrator_da__.RealTimeExportResult res = integrator_da__.RealTimeExporter.processExport(); 
}
-1

Comments

4 comments
Date Votes
  • Official comment

    Hi Andrew,

    As this trigger falls into the unmanaged code of the organization, Salesforce expects >75% test coverage. The managed package already has test cases and coverage of more than 75%. For the trigger, in order to have test coverage, you can write a simple test case as below which covers the trigger code.

    Below example is for the sObject type case and based on your requirement, sObject type and fields can be replaced.

    @isTest
    private class CeligoCaseTrigger {
    
        static testMethod void testCaseRecord() {
            // Create the Case Record.
            Test.startTest();
            Case cas = new Case(Status ='New', Priority = 'Medium', Origin = 'Email'); 
            insert cas;
            Test.stopTest();
        }
    }

    We will publish a help article with the details of how to have the test coverage added for the trigger.

    Thanks.

     

  • Rusty, the issue here is that you have to write tests in an Apex Class to verify the correct functionality of your Apex Trigger. The Trigger itself is fine but you have to have at least 75% code coverage in tests to be able to deploy a Trigger to Production. You can learn more about tests by taking this Trailhead module:

    https://trailhead.salesforce.com/content/learn/modules/apex_testing/apex_testing_triggers

    0
  • How on earth can Celigo require a trigger be put in place, yet not provide code coverage for it? I thought the value add of this platform was for business users to be able to manage...

    1
  • SAMANTHULA SRI SATYA SANTOSH KUMAR

     

    Do you know if there has been any official release to get this trigger through validation? 

    We're trying to deploy to production but are receiving a host of errors.  

    Thanks,

    Mike

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post