Setting Zendesk ticket status to Close with public reply

Originally asked by Timmy Summers on 04 April 2023 (original question)


Status changed to “Closed” in Jira → status sent to all Zendesk tickets linked to the closed Jira → Public reply added the corresponding ZD tickets “Hi your bug has been fixed” → Close all corresponding ZD tickets.

Would this be possible?

thanks!


Answer by Dario on 24 April 2023

Hello Timmy Summers

First in the Incoming Sync make sure you are mapping the correct status:

def statusMap = [
// “remote status name”: “local status name”
“Done” : “Closed”,
def remoteStatusName = replica.status.name
issue.setStatus(statusMap[remoteStatusName] ?: “To Do”) >> This will set a default status if the ones above are not found

Them set a comment to be created based on the replica.status.name coming from the remote node that matches the close status in your receiving instance.

if (replica.status.name == “Done”) {
issue.comments = commentHelper.addComment(“Hi your bug has been fixed”, issue.comments)
} else {
issue.comments = commentHelper.mergeComments(issue, replica)
}

Please let me know if this works for you, thanks!