Associate Jira work item with Salesforce records and trigger post actions automatically

Cloud Migration Resources

Planning a Jira Cloud migration? These resources can help you get started:

Connector for Salesforce & Jira Cloud features – Review Cloud features and understand key differences between DC and Cloud.
Migration support from Appfire – Learn how we can help you migrate smoothly.

Associate Jira work item with Salesforce records and trigger post actions automatically

Overview

Salesforce Apex API methods allow for associating a Jira work item with a Salesforce record or a list of Salesforce records and triggering a default action that happens immediately after an association. This simplifies the process of integrating Salesforce with Jira by eliminating the need for custom API code.

  • associateJiraIssue- associates a Jira work item with a list of Salesforce records, for example, cases, accounts, or contacts. It doesn’t trigger default post-actions after the association.

    • Syntax: associateJiraIssue(String jiraKey, List<SObject> sObjects)

    • Parameters:

      • jiraKey: The Jira work item key

      • sObject: A type of Salesforce object for the records you want to associate with the specified Jira work item. To learn more about sObject, see the Salesfors developers documentation.

  • associateJiraIssueWithDefaultPostActions - associates a Jira work item with a list of Salesforce records and triggers default post-action. Administrators can configure the default action that happens immediately after an association in the Connections settings.

  • After Associating.png
  • Syntax: associateJiraIssueWithDefaultPostActions(String jiraKey, List<SObject> sObjects)

    • Parameters:

      • jiraKey: The key of the Jira work item.

      • sObject: A type of Salesforce object for the records you want to associate with the Jira work item. To learn more about sObject, see the Salesforse developers documentation.

These methods eliminate the need for complex custom code when interacting with Jira endpoints to update associations.

 

 

Before you start

Instructions

  1. In Salesforce, in the upper right corner, click the gear icon (image-20241008-110859.png) and select Setup.

  2. In the Quick Find box, type Apex Triggers.

  3. Click Developer Console on the Apex Triggers screen.

    Apex Triggers.png
  4. On the Developer Console screen, select File > New > Appex Trigger.

    New Apex Trigger.png
  5. Fill in Apex Trigger details:
    For example:
    Name: AssociateOnCreate
    sObject: Case - Select the Salesforce Object type you want to associate from the list.

    Submit New Apex Trigger.png
  6. Click Submit.

  7. Paste the Apex Trigger into the code console.

    Example code.png

Example Apex Trigger

Here is an example of using associateJiraIssueWithDefaultPostActions in an Apex trigger to associate a Jira work item with newly created Salesforce cases:

Jira Cloud

trigger AssociateOnCreate on Case (after insert) { JCFS.API.associateJiraIssueWithDefaultPostActions('S8U-8', Trigger.new); }

 

 

Need support? Create a request with our support team.

Copyright © 2005 - 2026 Appfire | All rights reserved.