Skip to main content
Skip table of contents

Add Trigger to Opportunity for capturing updates to send to Jira

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

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) {

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

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

        Id oppId = opp.Id;

            //Update record
            opp.Name += '(Edited)';
            update opp;

            //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');
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.