You can configure Connector for Salesforce & Jira to send email notifications when an event is triggered.
The set up consists of two parts:
- Specifying Jira groups to notify, in Jira.
- Creating and deploying required Apex triggers, in Salesforce.
At the moment, the Connector supports sending email notifications to Jira users when someone creates a Case comment.
Specifying Jira Groups to notify
Jira groups can be specified at the Connection level. This affects each binding and Jira project that is using the Connection.
- Go to
- At the Salesforce Connections screen, go to the Connection you want to configure > Configure.
- Under Notification Settings, choose who you want to send notifications to by selecting All recipients of Issue Commented event, Current Assignee, Reporter, All Watchers, All Voters and/or Groups.
For more information about All recipients of Issue Commented event, see "Sending Notifications Based on a Project's Notification Scheme".
- Click Save.
Sending notifications based on a Project's notification scheme
The All recipients of Issue Commented event setting allows you to enable email notifications that are defined within your Jira's Notification Scheme.
The event that is triggered is the Issue Commented event and is dependent on the Notification Scheme that is set up for the project that the Connection is bound to.
Do take note that only the following recipients are supported:
- Current Assignee
- Single User
- All Watchers
Creating and deploying Apex triggers
The Connector relies on Apex triggers to be informed of changes on Salesforce objects. These triggers have to be created and deployed manually in Salesforce.
For Salesforce Enterprise and Unlimited editions, the standard deployment of Apex triggers are required (see Salesforce documentation).
Notifying Jira of new comments on Cases
This provides notifications when someone creates a comment in Salesforce.
Note that the email notification will be sent:
- Based on the Comment Privacy and Comment Tag Filter settings in the Connection configuration page.
- Only to Jira issues currently associated with the Case.
- Only to Jira users (in the specified groups) who have access to the associated Jira issue.
A successful email notification may look like this:
Adding CaseComment trigger
The JCFS.API.fireEvents() API endpoint allows Jira to be notified of events happening in Salesforce, typically originating from Salesforce triggers.
Call JCFS.API.fireEvents() in an after insert Trigger on CaseComment as follows:
If you don't wish to send all triggered CaseComment objects to Jira, you can simply pass a filtered List<CaseComment> to JCFS.Events.fromCaseComments() .
The JSFS.API.fireEvents() API endpoint allows Jira to be notified of events happening in Salesforce, typically originating from Salesforce triggers.
Call JSFS.API.fireEvents() in an after insert Trigger on CaseComment as follows:
If you don't wish to send all triggered CaseComment objects to Jira, you can simply pass a filtered List<CaseComment> to JSFS.Events.fromCaseComments() .
Testing CaseComment trigger
To get test coverage for CaseComment trigger use the provided test helper as shown:
If you have other triggers with Webservice callouts that are executed as a result of running this test, you might get an error message like this:
In order to fix this error, you need to specify a fake response for the callouts. JiraTriggerTestHelper already provides a mock for its test method, but it will not mock other webservice callouts. Therefore, you may need to provide your own implementation of HttpCalloutMock.
Please customize the following code according to your callout method:
Then, set the mock before the CaseCommentCreatedTriggerTest test method is called.
For more details, please refer to the Salesforce documentation.