JIRA to Zendesk - add comment

Originally asked by Mikael Bohlin on 13 March 2020 (original question)


How to add a text string in front of the synced comment from JIRA to Zendesk side in order to identify the name of the updater in JIRA.Source: Zendesk (old community)


Answer by Juan Grases on 13 March 2020

Hi!

You can do something like:

replica.addedComments = replica.addedComments.collect{ c ->
	def remoteAuthor = c.author.username
	c.body = "Comment from "+remoteAuthor+" in Jira:\n "+c.body
	c
}
issue.comments     += replica.addedComments


Comments:

Mikael Bohlin commented on 16 March 2020

Hi,

thank you for feedback. Unfortunatly the “author” was not synced. I assume this is setup on the incomming side on Zendesk ?

Juan Grases commented on 16 March 2020

Could you clarify on “the author was not synced”? You mean that the comment from Jira, was created in zendesk with the text "Comment from null in Jira:\n "+c.body ?

Mikael Bohlin commented on 19 March 2020

Yes , correct we received null from c.author.username in Zendesk.

How to fix ?

Juan Grases commented on 19 March 2020

It seems username is not available on Jira Cloud due GDPR limitations, you can use email instead:

replica.addedComments = replica.addedComments.collect{ c ->
	def remoteAuthor = c.author.email
	c.body = "Comment from "+remoteAuthor+" in Jira:\n "+c.body
	c
}
issue.comments     += replica.addedComments
Mikael Bohlin commented on 19 March 2020

OK, that worked,

do you have a list of “variables” that we can use ?

Regards

Mikael

Juan Grases commented on 19 March 2020

Could you create that as a separate question (old community) ?

Thanks!

Juan

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