Page History
Epic -> Feature -> Story, Task -> Sub-task
In this documentation, I will show you how to keep the Epic link and issue link between issues and workItems work items in Jira Cloud and Azure DevOps
...
1) From Azure DevOps to Jira Cloud
ADO Outgoing Sync
First, we need to add a few new lines in the Outgoing script.
...
With the httpClient we get the relations of the issues if the issue does not have a releation relation to another issue we don't set the "replica.relations" variable.
...
In the Jira Incoming sync well , we'll start from the top and work to the bottenbottom, you'll just have to Copy & paste these values and change some values so they match your instance.
...
- So first you need to change the project name to your Jira Cloud project name.
- Change the values in the typeMap to the issueTypes you have on your ADO instance (the types before ":") and the IssueTypes on your Jira instance (the types after ":")
- Example: ["Azure devOps":"Jira Cloud"]
- On line 11 we'll set the issueType when the type is found in the TypeMap it will set issueType to that value if it's not found it's going to look if the issuetype exsists in your project if not it will set it to a default value, a Task in this case.
- Then on line 14, we check if the issueType is an epic, if it's an epic we will set the Epic name to the given summary
...
Here we will determine which issue needs to be linked to which issue, If the issue does not has have a parentId it does not need to be linked.
...
- We are going to check if the issueType is a Feature (this can be different on in other instances, change "Feature" to the issueType that suits you) and that the parentId is not empty
- The Feature here is linked under the Epic so when it's a feature we will link it to the Epic if the parentId is not empty.
- When the next issue (Story) has a parent (Feature) they have a relation link and then the 2 issues will be linked together
...
Info | ||
---|---|---|
| ||
Change the values to the values you get form from ADO (first values before the ":") and the values you have in your Jira issueTypes (last values after the ":") |
...
4) System & Custom Fields.
Now we did have done the paren parent-child link we only need to add the System or custom fields that you also want to set in you your Jira issue.
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
issue.summary = replica.summary issue.description = replica.description issue.comments = commentHelper.mergeComments(issue, replica) issue.attachments = attachmentHelper.mergeAttachments(issue, replica) issue.labels = replica.labels // Custom Fields //issue.customFields."CF Name".value = replica.customFields."CF Name".value |
...
Jira Cloud Outgoing Script
First, we need to add a few values in the Jira Outgoing sync.
...
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
// Add these to the outging script replica.linkedIssues = issue.issueLinks replica.parentId = issue.parentId |
We need thelinkedIssues the linked issues and the parentId to see in ADO wich which issues are linked with each other.
...
Info | ||
---|---|---|
| ||
Change the values to the values you get form from Jira (first values before the ":") and the values you have in your ADO issueTypes (last values after the ":") |
...
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
def setStatus(){ // First we determine which Issue Type has which statuses Epic, Feature, Story, etc... def statusMappingEpic = [ // "Jira values":"ADO Values" "Open":"Open", "In Progress":"Doing", "Done":"Closed" ] def statusMappingFeature = [ // "Jira values":"ADO Values" "Open":"To Do", "In Progress":"Doing", "Done":"Closed" ] def statusMappingStory = [ // "Jira values":"ADO Values" "Open":"To Do", "In Progress":"Doing", "Done":"Closed" ] def remoteStatusName = replica.status.name // Status name from the Jira side // We wil check which issueType this issue has and them map the right Statuses to it, the default value is set to the default value you want. if (issue.type.name == "Epic"){ return statusMappingEpic[remoteStatusName] ?: "Open"} if (issue.type.name == "Feature"){ return statusMappingFeature[remoteStatusName] ?: "To Do"} if (issue.type.name == "User Story"){ return statusMappingStory[remoteStatusName] ?: "To Do"} // We return the right value and set the right Status in your issue } // We do this after the first sync other wise it can cause troubles. if (!firstSync){ workItem.setStatus(setStatus()) } |
Questions
4) System & Custom Fields.
Now we have done the parent-child link we only need to add the System or custom fields that you also want to set in your Jira issue.
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
workItem.summary = replica.summary
workItem.description = replica.description
workItem.attachments = attachmentHelper.mergeAttachments(workItem, replica)
workItem.comments = commentHelper.mergeComments(workItem, replica)
workItem.labels = replica.labels
workItem.priority = replica.priority |
And you're done This is the implementation to keep the issue link hierarchy.
Here is an image of how a Task and a sub-task are synced over from Jira in ADO.
Here is an image of how the Epic hierarchy is synced over
Questions List