Status sync from Zendesk to Jira for few status

Originally asked by Shaleen Kukreti on 12 June 2023 (original question)


Current flow: ZD → Jira. All statuses in ZD need to map with the status in Jira.

Use case: I only want, “Open” and “Solved” statuses from ZD to be mapped to “Open” and “Done” status in Jira, but while doing so, in the rest of the status I am getting errors and the ticket is not syncing.

Please suggest, if that could be possible.


Answer by Syed Majid Hassan on 13 June 2023

Yes, this should be very possible. The trick here is to only allow a status change in Jira when you want it. Something on the lines of the following code snippet (not tested) should do the job:

def statusMap = [
   "open" : "Open",
   "solved" : "Done"
]
def remoteStatusName = replica.status.name
if (remoteStatusName == "open" || remoteStatusName == "solved")
         issue.setStatus(statusMap[remoteStatusName]

Please let me know how it goes.

Thanks

Majid


Answer by Syed Majid Hassan on 14 June 2023

No, in fact I left the bold part out on purpose. This is the default value that the system relies on if it does not find a match in the map you created. I would personally not include it from the initial description you provided, but if you are all set, that is great to hear!

Thanks

Majid


Answer by Shaleen Kukreti on 13 June 2023

Thanks Syed Majid Hassan , it seems working, I believe you forgot to add the bold part in the below code, by using it its working.

Code: issue.setStatus(statusMap[remoteStatusName] ?: remoteStatusName)


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.