How to set up a sync between multiple Zendesk tickets to one Jira Cloud issue?

Originally asked by Mariia Onyshchenko on 04 November 2020 (original question)


Context:

The clients currently have a Jira server instance with a linked Zendesk portal, and a Jira cloud instance with a separate linked Zendesk portal. Both Zendesk portals are currently linked using the Zendesk Support for Jira app. The Jira server instance is being merged into the cloud site, and they require both Zendesk portals to remain synchronised to the single Jira cloud instance as they are two separate teams.

Could you clarify on the multiple tickets linked to a single ticket? Do you mean setting up multiple identical connections between the Zendesk portal and the cloud site? Currently (in the trial run), I can only see an option to exalate once on a Jira issue, and exalating a ticket to a Jira issue with an existing synchronisation does not work, using a single connection between the Zendesk portal and the Jira cloud site.

I cannot find in the documentation, how to set up many Zendesk tickets to one Jira Cloud issue with a single connection using Connect API. I


Answer by André Leroy-Beaulieu Castro on 06 November 2020

Hi!

Thanks for raising this question.

Yes you can certainly do this. The idea will be to create a custom field in Zendesk and populate it with the Jira Issue Key that you want to connect to, so once you Exalate the Zendesk ticket, the following code will be executed in the Jira side and will connect the corresponding tickets:

Zendesk Outgoing Sync:

replica.customFields.“Issue to connect to" = issue.customFields."Issue to connect to"

Jira Incoming Sync:

def remoteIssueUrn =replica.customFields."Issue to connect to"?.value
if(remoteIssueUrn && firstSync){
  def localIssue = httpClient.get("/rest/api/2/issue/"+remoteIssueUrn)
  if(localIssue == null) throw new com.exalate.api.exception.IssueTrackerException("Issue with key "+remoteIssueUrn+" was not found")
  issue.id = localIssue?.id
  issue.key = localIssue?.key
  return;
}

Thanks,

André


Comments:

James Gwynne commented on 09 November 2020

Hi André,

Thank you for the response. However, in the connection I only have ‘rules’ and not ‘outbound rules’ or ‘inbound rules’. How do I go about getting/finding where I can set node specific outbound and inbound (script) rules? Updating the ‘rules’ does so for both the Zendesk and Jira side of the connection.

Kind regards,

James

Mariia Onyshchenko commented on 09 November 2020

James,

I’ll trust you’re using Visual mode a the moment? You can only get to the ‘outbound rules’ via database via running SQL queries on both instances.

It’ll be easier if you create a new connection, this time chose “Scripting mode”.

Best,
Mariia

James Gwynne commented on 09 November 2020

Hi Mariia,

Yes, I was using Visual Mode. I can confirm that this works as expected. Is it possible to facilitate this into bulk connect in any automated way? What led to this was the fact that the clients have multiple tickets linked to the same issue, and the historic links need to be imported into the new Exalate connection. Of course, doing this manually may not be viable.

Kind regards,

James