Hi @spulakhandam ,
I have covered two use cases out of three which we had discussed in our last call.
-
If Request Type = Defect on Zendesk, then it should create Work Item with ‘Bug’ issueType on Jcloud
-
If Request Type = Defect on Zendesk, and if the issueType = Bug on Jira cloud, then no ASSIGNEE field should be synced. And if Request Type is other than ‘Defect’ for field ‘Request Type’ on Zendesk, then it will create ‘Task’ (or any other field you define) in Jira cloud as well as will synchronise Assignee field value
Zendesk – Outgoing sync rule:
replica.assignee = issue.assignee
replica.customFields."requestType" = issue.customFields."Request Type"
Jira cloud – Incoming Sync rule:
if (firstSync) {
issue.projectKey = "TP"
// Extract Zendesk Request Type tag safely
def requestType = replica.customFields."requestType"?.value?.value?.toLowerCase()
// Set issue type based on Request Type
if (requestType == "defect") {
issue.typeName = "Bug"
} else {
issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Task"
}
}
// Common field mappings
issue.summary = replica.summary
issue.description = replica.description
issue.comments = commentHelper.mergeComments(issue, replica)
issue.attachments = attachmentHelper.mergeAttachments(issue, replica)
// issue.labels = replica.labels // intentionally skipped
// Handle Assignee only if NOT a Defect/Bug
def requestType = replica.customFields."requestType"?.value?.value?.toLowerCase()
if (requestType != "defect") {
def assignedUser = nodeHelper.getUserByEmail(replica.assignee?.email)
if (assignedUser) {
issue.assignee = assignedUser
} else {
log.warn("Assignee '${replica.assignee?.email}' not found in Jira — skipping assignment.")
}
} else {
log.warn("Skipping assignee sync because Request Type = Defect (Bug).")
}
Now the third and last use case is remaining which I will work on early next week.
- If Request Type = Defect on Zendesk, and if the issueType = Bug on Jira cloud, then no STATUS value from Jcloud to Zendesk field named “Jira Status” (text type) should be synced.
Please try these out, and let me know the outcome.
Thank you,
Ashar