You will need to create the trigger and its unit test in a sandbox environment and then deploy into production by promoting a Change Set.  For more information on this, please  refer to https://help.salesforce.com/articleView?id=000171224&type=1

The object that is integrated with Jira (ex: Opportunity) will need a trigger to send to Jira its events (updates, deletes).

This step is not needed for Account and Contact objects, since the triggers for these objects are already provided with zAgileConnect.

References to Opportunity in the code below (used in the example flow) will be replaced by the object to be integrated with Jira.

trigger OpportunityTrigger on Opportunity (before delete, after delete, after update, after undelete) {
    zsfjira.ZTriggerFactory.createAndExecuteHandler(Opportunity.sObjectType);
}
CODE


You will need a unit test for the trigger in order to deploy it to production:

@isTest
private class OpportunityTriggerTest {
    static testMethod void testTrigger() {
        //Create Record
        Opportunity opp = new Opportunity();
        //Fill fields
        opp.Name='Test Name';
        opp.StageName = 'Qualification';
        opp.CloseDate = Date.today()+30;
        insert opp;

        Id oppId = opp.Id;

        try{
            //Update record
            opp.Name += '(Edited)';
            update opp;
            System.assert(opp!=null);

            //Delete record
            delete opp;
            System.assertEquals(0,[SELECT count() FROM Opportunity WHERE Id =:oppId]);
        }catch(zsfjira.ZTriggerFactory.ZTriggerException exe){
            System.assert(false, 'Trigger could be defined incorrectly');
        }
    }
}
CODE


Back Next