Jira to Zendesk : Placeholders

Originally asked by Andrew Hogan on 12 January 2021 (original question)


When a comment is synced from our Jira to Zendesk, it would be handy if we could use the Zendesk placeholders, such as: {{ticket.title}}

When we try using those codes in a Jira comment, it reaches Zendesk as: \{\{ticket.title}}.

Is there a way our users can add the placeholders in a Jira comment and have Zendesk apply the value substations when a comment is synced?

Our Zendesk sync code for comments is:

issue.comments = commentHelper.mergeComments(issue, replica,                      
	{
		comment ->
		comment.body =
		comment.author.displayName +" commented on ${replica.key}: \n \n" +
		comment.body
	}

Thanks.


Answer by Francis Martens (Exalate) on 12 January 2021

You could create your own placeholders and replace these in the incoming sync on the zendesk side.

For instance if ‘{ticket.title}’ needs to be replaced you can then have on the zendesk side

issue.comments = commentHelper.mergeComments(issue, replica,                      {
		comment ->


        def body = comment.body
        body = body.replace("{{ticket.title}}", issue.summary)
        body = body.replace("{{ticket.description}}", issue.description)

		comment.body =
		comment.author.displayName +" commented on ${replica.key}: \n \n" +
		body
	}

Comments:

Andrew Hogan commented on 13 January 2021

Thanks Francis,

Is there any way to pick up values that Jira doesn’t have, such as {{ticket.requester.first_name}}