How to Sync Statuses & Custom Fields Between Salesforce and Jira

Salesforce to Jira integration

This article was originally published on the Atlassian Community and the Salesforce Community.

Both Jira and Salesforce support default fields and entities for conveying and displaying data—which is accessible by referencing the API key.

But what if the default fields don’t have what you need? 

In that case, you can create custom fields on both platforms and adjust the mapping to sync them.
In this post, I’ll show you how to sync data between custom fields on Jira and Salesforce.

How to Add Custom Fields in Jira 

Jira supports different types of custom fields (checkboxes, date pickers, user pickers, radio buttons, select lists, and much more). Here are the steps for creating custom Jira fields.

  1. Open your Jira. 
  2. Select Issues.
  3. Go to Fields and Click Custom Fields.
  4. Select the custom field you want to create. Then, add context and default value. 
  5. You can also change the name and assign the screens on which the field should appear.
  6. Select Edit Default Value to change the data (for editable custom fields). 

To retrieve data from the field, you need to call the custom field ID from the Jira REST API.

How to Add Custom Fields in Salesforce 

Salesforce users can create custom fields for standard objects (formula, date, email, phone, picklist, etc). Here are the steps to follow:

  1. Go to Object Manager.
  2. Click Contact > Click Fields and Relationshionships > Click New.
  3. Choose the data type and click Next.
  4. Enter the values on separate lines, then click Next.
  5. Select the Contact page layout and click Save.

The custom field will appear on the layout. To retrieve data from it, write the name without spaces and add “__c” (MyCustomField__c).

Why Sync Jira Custom Fields with a Salesforce Account? 

Most organizations integrate custom field data between Jira and Salesforce in order to extend the possibilities of both platforms.

For instance, your organization’s customer success partner can add an Account custom field in Jira to store data coming from the default account field on the sales team’s Salesforce.

Doing so will help the customer success partner to exchange data in real time with the corresponding team to make timely, informed sales decisions and close deals faster.

Syncing custom field data also improves communication between connected teams, especially for cross-company collaborations that require constant communication and transparency. 

You can add up to 50 custom fields to your Jira instance in order to obtain extra data points.

What are the Challenges of Syncing Custom Field Data?

In my experience working with custom fields, here are some challenges I’ve bumped into.

  • Remembering the corresponding field on the other side,
  • Finding the right API name for scripting the connection,
  • Getting the data transformation right for pinpoint accuracy,
  • Not exceeding the API usage and call limits,
  • Having an automatic retry mechanism for network failures,
  • Limiting write access to only authorized users within the project or organization.

These problems are common when you decide to build your Jira Salesforce integration solution from scratch. 

But it doesn’t have to be this way. You can configure the sync using third-party integration solutions that require little to no extra scripting or coding.

One such solution is Exalate. This Jira Salesforce integration tool comes with a Groovy-based engine that allows you to sync custom fields bidirectionally without the hassle of writing custom transformations for both platforms. 

Exalate is a two-way integration solution that works with Zendesk, Azure DevOps, ServiceNow, Jira, Salesforce, etc. 

  • You can use it to sync Salesforce and Jira custom fields as well as several other entities.
  • The Bulk Exalate feature allows you to create a trigger for syncing existing issues.
  • Exalate’s Groovy scripting engine is apt for configuring complex use cases.
  • Exalate allows you to limit what goes in or comes out of your system.

With a bit of customization, you can sync data from custom fields and map them to existing or newly created default fields.

Jira to Salesforce Use Case: Custom Field Update and Status Sync

Selecting an account name for a custom drop-down field in a Jira issue triggers a sync with the corresponding Salesforce case entity. 

At the same time, changing the status of your Jira issue will also update the status of the corresponding Salesforce Case. 

Sounds complicated, right? Let me show you the requirements and challenges:

Primary Requirements

When a team member picks a user from the drop-down list, the selected option appears as a text value on a custom field on the Salesforce side. 

For this to work, you’d need to establish sync rules to control the incoming and outgoing data in custom fields. These rules are single lines of code.

You can also set triggers to update the field on both the Jira and Salesforce instances automatically and bi-directionally

How to Implement Exalate for Data Updates

First, install Exalate on both the Salesforce and Jira sides. Next, follow the instructions in this comprehensive guide to establish a connection between them.

For advanced use cases such as this, you must set up a connection using Exalate’s Script Mode. After that, you can commence with the sync.

Go to your Jira dashboard and create a new issue.

Then, open the Exalate console in Jira. Go to the connection you want to edit and click on the “Edit connection” icon. 

Then change the sync rules under the “Rules” tab. 

You have two text boxes: 

  • Outgoing sync (on the Jira side) refers to the data to be sent over to the Salesforce side. 
  • Incoming sync (on the Salesforce side) refers to the data to be received from the issue on Jira.

The same logic applies to incoming and outgoing in the other direction.

outgoing sync exalate

Under the “Rules” tab, enter the following code snippet into the Jira “Outgoing sync” text box. 

replica.customFields."SF Contact" = issue.customFields."SF Contact"

Note: The issue.customFields function points to the custom field name within the Jira issue. The replica works as a payload or a message. It contains information you want to pass between the two systems

incoming sync exalate

In the Jira “Incoming sync” text box, enter the following snippet:

def statusMapping = ["New":"To Do", "Working":"In Progress","Escalated":"Done"]

def remoteStatusName = replica.Status.value

issue.setStatus(statusMapping[remoteStatusName] ?: remoteStatusName)

Note: The statusMapping variable establishes the relationship between statuses. The remoteStatusName maps to the replica’s status. Eg., A “New” case on Salesforce appears as “To Do” in Jira.

Once done, click “Publish” to save the changes.

On the Salesforce side, enter the code in the “Incoming sync” text box.

salesforce exalate incoming
"New":"To Do",
"In Progress": "Working",
"Done": "Escalated",

  ]
  def remoteStatusName = replica.status.name
  statusName = statusMap[remoteStatusName] ?: remoteStatusName
  entity.Status = statusName

entity."Jira_custom_field__c" = replica.customFields."SF Contact".value.value

Note: The statusMap variable establishes the relationship between statuses. The remoteStatusName maps to the replica’s status name. Eg., An “Escalated” case on Salesforce appears as “Done” in Jira. The entity."Jira_custom_field__c" function points to the custom field “Jira custom field” within Salesforce. The replica contains information you want to pass between the two systems

Once done, click “Publish” to save the changes.

Set Up Automated Triggers

Triggers start your sync automatically based on the conditions you specify. 

On the Salesforce side, you need to use SOQL (Salesforce Object Query Language) to configure the trigger or you can opt for filters. You can choose any entity, whether an Opportunity, Case, or Account. 

Triggers in Salesforce

Configure your trigger to the sync requirements and click “Add”.

 On the Jira side, you can configure triggers using Jira Query Language (JQL).

Here are sample triggers and explanations:

PlatformExpressionMeaning
Jiraproject = BLUE AND issuetype = BugSync any Bug created in project “BLUE”.
SalesforceStageName= 'Prospecting' AND Name like '%demo%'Sync any Opportunity at the ‘Prospecting’ stage and has a name that includes the word ‘demo’.

You can read more about Exalate triggers here.

Now go back to the Jira issue and choose a user from the “SF Contact” drop-down list. Then change the status to “Done”.

jira salesforce contact

Back on Salesforce, you will see the account name appear in the “Jira custom field” automatically.

salesforce jira custom

Congratulations! You have now set rules to help you update and sync custom Jira fields to Salesforce. 

If you still have questions or want to see how Exalate is tailored to your specific use case, book a demo with one of our experts right away.

Recommended Reading:

Comments are closed.