How to Sync Text, Date, and Picklist Custom Fields Between Jira and Azure DevOps

Jira Azure DevOps integration

This post has been published in the Atlassian community.

Jira Azure DevOps integration is the need of the day. Both Jira and Azure DevOps offer robust features but when it comes to integrating data like custom fields, things can get tricky. 

This is where tools like Exalate can help, ensuring your custom data flows effortlessly between Jira and Azure DevOps.

In this blog, we’ll dive into a common use case: syncing custom fields between Jira and Azure DevOps. 

We’ll explore the key custom fields—Text, Picklist, and Date—and provide code snippets to illustrate how Exalate makes this process straightforward. 

Why Sync Custom Fields?

Custom fields allow teams to capture unique data that goes beyond standard fields like summary or status. By syncing custom fields, you ensure that all teams, regardless of the platform they use, have access to the same critical information. This leads to better collaboration, reduced errors, and a unified workflow.

Setting Up the Environment for Syncing Custom Fields between Jira and Azure DevOps

Start by installing Exalate on Jira and Azure DevOps and connect them using the Script mode. 

The Script mode has incoming and outgoing sync rules written using low-code Groovy scripts. You can edit them at both integrating ends to meet your sync requirements. 

To send custom field data from a Jira issue field to its corresponding Azure DevOps work item field you’d need to modify the outgoing sync rules of your Jira instance. 

You would also need to receive the data coming from Jira in some work item field. For this, you’d need to modify the incoming sync rules of your Azure DevOps instance. 

To do this the other way around, simply reverse the codes in the incoming and outgoing sync scripts. 

That’s all! Set an automatic trigger as the next step and see your data synced smoothly between the systems. 

Custom Fields Sync: A Deeper Look

Jira to Azure DevOps Text Field Sync

Text fields are commonly used to capture detailed information. Whether it’s a technical description or customer feedback, syncing text fields ensures that all teams have a consistent narrative.

//Jira outgoing sync
replica.customFields."CF Name" = issue.customFields."CF Name"

//Azure DevOps incoming sync
workItem.customFields."CF Name".value = replica.customFields."CF Name".value

Here, we simply map the text field from Jira to Azure DevOps and vice versa. Exalate takes care of the data transformation and transmission.

Jira to Azure DevOps Picklist (Select List) Field Sync

Picklist or select list fields are perfect for categorizing information, like selecting a priority level or feature type. Syncing these ensures that the categorizations are consistent across platforms.

//Jira outgoing sync
replica.customFields."CF Name" = issue.customFields."CF Name"

//Azure DevOps incoming sync workItem.customFields."CF Name".value = replica.customFields."CF Name".value.value

The code snippet captures the picklist object with its values in one platform and assigns it to the corresponding field in the other.

Jira to Azure DevOps Date Field Sync

Date fields are essential for tracking deadlines, milestones, and other time-sensitive data. Keeping dates in sync prevents miscommunications and scheduling conflicts.

//Jira outgoing sync
replica.customFields."CF Name" = issue.customFields."CF Name"
//Azure DevOps incoming sync
import java.text.SimpleDateFormat....def sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss")def targetDate = sdf.format(new Date())

//throw new Exception("Target date = ${targetDate}")workItem."Microsoft.VSTS.Scheduling.StartDate" = targetDate

This snippet ensures that the date values are synchronized, keeping project timelines aligned.

Best Practices for Syncing Custom Fields Between Jira and Azure DevOps

  • Consistent field types: Ensure that the custom fields in Jira and Azure DevOps have compatible types.
  • Field mapping: Carefully map the fields to avoid data loss or misinterpretation.
  • Testing: Always test the sync setup in a sandbox environment before deploying it in production.

Conclusion

Synchronizing custom fields between Jira and Azure DevOps can enhance your project’s efficiency and transparency. It ensures all teams have access to the same data, regardless of the platforms they use.

Ready to sync more data between Jira and Azure DevOps? Book a demo with us and find out how!

Recommended Reading:

Comments are closed.