Hello,
Im trying to get two things
1 - Jira Status to update the Tag on the DevOps ticket
when Jira status is Dev In Progress then DevOps tag should be Ready for Sprint
2- DevOps Tag to update Jira status
when Tag in Devops is Ready for UAT Testing then Jira Status to change to UAT Testing
And
when Tag in DevOps is Deployed to PRD then Jira status to change to Deployed in Prod
My code is as follows:
Outgoing Jira:
// let DevOps know which JIRA key this came from
replica.key = issue.key
// basic fields
replica.summary = issue.summary
replica.priority = issue.priority
//This line below, transforms description from Markdown to HTML to transfer over
replica.description = nodeHelper.getHtmlField(issue, “description”)
replica.attachments = issue.attachments
replica.status = issue.status
// custom-field mappings (make sure the names match exactly what you use in Azure incoming)
replica.customFields.“DevOpsProject” = issue.customFields.“DevOps Project”
replica.customFields.“CustomerRequestType” = issue.customFields.“Customer Request Type”
replica.customFields.“Estimate” = issue.customFields.“Estimated Effort”
Incoming Jira
if (firstSync) {
issue.projectKey = “ITS”
issue.typeName = “CI”
}
if(!firstSync && syncRequest.remoteSyncEventNumber==1){
issue.customFields.“Remote URL”.value = issueUrl
}
// Map DevOps tags to Jira statuses
// If tag in DevOps is ‘Ready for UAT Testing’ then Jira status should change to ‘UAT Testing’
// If tag in DevOps is ‘Deployed to PRD’ then Jira status should change to ‘Deployed to Prod’
def tagToStatusMap = [
‘Ready for UAT Testing’: ‘UAT Testing’,
‘Deployed to PRD’ : ‘Deployed to Prod’
]
def devopsTags = replica.tags ?:
// Find the first tag that matches our mapping
for (tag in devopsTags) {
if (tagToStatusMap.containsKey(tag)) {
issue.setStatus(tagToStatusMap[tag])
break
}
}
Outgoing DevOps
// Outgoing script (Azure DevOps → Jira)
replica.key = workItem.key
replica.summary = workItem.summary
replica.description = workItem.description
replica.tags = issue.labels
Incoming DevOps
if (firstSync) {
workItem.projectKey = replica.customFields.“DevOpsProject”?.value?.value ?: “DEFAULT_PROJECT”
workItem.typeName = “User Story”
workItem.summary = replica.summary
syncHelper.syncBackAfterProcessing()
}
workItem.description = replica.description
workItem.attachments = replica.attachments
workItem.priority = replica.priority
if (firstSync) {
store()
workItem.customFields.“JIRA”.value = issueUrl
workItem.customFields.“Estimate”.value = replica.Estimate
} else {
workItem.customFields.“JIRA”.value = issueUrl
}
// Add tag ‘Ready for Sprint’ if Jira status is ‘Dev In Progress’.
// Only set the tags field if the status is exactly ‘Dev In Progress’.
if (replica.status?.name == “Dev In Progress”) {
workItem.tags = [“Ready for Sprint”]
}
Any ideas? (This code was suggested by the AI in the Exalate screens)
Thanks