xl8bot
November 4, 2024, 7:11am
1
Originally asked by Ken Vetter on 03 March 2021 (original question)
Hello. And working on a POC for a client.
I am using groovy scripting method to sync.
When I create a Issue/Story in Jira I want the sync to create a matching User Story in Azure DevOps board.
Currently the work item on Azure side is defaulting to a task with same name as Story on Jira side.
How do I get the sync to create like for like items?
xl8bot
November 4, 2024, 7:11am
2
Answer by Ken Vetter on 03 March 2021
Outgoing sync from Jira: (pretty much default)
replica.key = issue.key
replica.type = issue.type
replica.assignee = issue.assignee
replica.reporter = issue.reporter
replica.summary = issue.summary
replica.description = issue.description
replica.labels = issue.labels
replica.comments = issue.comments
replica.resolution = issue.resolution
replica.status = issue.status
replica.parentId = issue.parentId
replica.priority = issue.priority
replica.attachments = issue.attachments
replica.project = issue.project
replica.originalEstimate = issue.originalEstimate
replica.spent = issue.spent
replica.estimate = issue.estimate
//Comment these lines out if you are interested in sending the full list of versions and components of the source project.
replica.project.versions =
replica.project.components =
Incoming sync to Azure: (I’ve tried a few things, and left some of them commented out)
if(firstSync){
//Set type name from source entity, if not found set a default
//workItem.typeName = nodeHelper.getIssueType(replica.type?.name)?.name ?: “Task”;
workItem.type = (replica.type)
}
workItem.type = issue.type
workItem.summary = replica.summary
workItem.description = replica.description
//workItem.description = nodeHelper.getIssueType(replica.type?.name)?.name
workItem.priority = replica.priority
workItem.labels = replica.labels
workItem.attachments = attachmentHelper.mergeAttachments(workItem, replica)
workItem.comments = commentHelper.mergeComments(workItem, replica)
//Time Tracking
if(replica.originalEstimate) {
workItem.“Microsoft.VSTS.Scheduling.OriginalEstimate” = (replica.originalEstimate as Double)/3600
}
if(replica.estimate) {
workItem.“Microsoft.VSTS.Scheduling.RemainingWork” = (replica.estimate as Double)/3600
}
if(replica.spent) {
workItem.“Microsoft.VSTS.Scheduling.CompletedWork” = (replica.spent as Double)/3600
}
xl8bot
November 4, 2024, 7:11am
3
Answer by Mariia Horbatiuk on 03 March 2021
Hello Ken,
Is it possible to provide outgoing and incoming sync rules from both sides?
We need to see how the sync is set to be able to help you in a timely manner
Thank you!
Comments:
Ken Vetter commented on 04 March 2021
Hello Mariia.
Is there any update on this?
Mariia Horbatiuk commented on 05 March 2021
Hello Ken, I need a bit of time to reproduce the setup and propose a method.
Ken Vetter commented on 10 March 2021
Hello Mariia,
I have come up with the solution. On the incoming Azure side I have added this scripting.
Not sure all of it is required, I haven’t tried commenting out any parts to see.
//map issue types between source and destination instances.
def issueTypeMapping = [
// “remote issue type” : “local issue type”
“Epic” : “Epic”,
“Feature” : “Feature”,
“Story” : “User Story”,
“Bug” : “Bug”,
“Task” : “Task”
]
if(replica.type.name == “Story”) {
workItem.typeName = “User Story”
}
else{
workItem.typeName = “Task”
}
Now if I create a new issue (type Story) in Jira, it will produce a User Story in Azure