Originally asked by Svein Tvedt on 27 July 2021 (original question)
Hi again
I am not able to figure this one out and I hope you can help me out.
I am trying to update my Visual connection between Zendesk and Jira and the script that I created below based on the answer that you gave me in the last post I submitted.
What I am trying to accomplish now is that I only want public reply comments from Jira to be synchronized with Zendesk. Jira (Payments) to Zendesk (CS).
I have tried looking up the documentation, but it seemed to be geared towards Scripting connections as I am not getting that code to work. I tried what was posted here, but thatโs not working for me: Only sync internal comments (old community) (doing it like this: replica.comments = issue.comments.``findAll``{!it.internal}
which can be found here https://docs.idalko.com/exalate/display/ED/How+to+synchronize+comments)
if (executionInstanceName == "Payments") {
replica.comments = nodeHelper.getHtmlComments(issue)
replica.comments = commentHelper.mergeComments(issue, replica,{
comment ->
comment.body =
comment.author.displayName +
" commented: \n" +
comment.body + "\n"
}
)
}
if (executionInstanceName == "CS") {
replica.comments = commentHelper.mergeComments(issue, replica, {
comment ->
comment.internal = true
comment.body =
comment.author.displayName +
" commented: \n" +
comment.body + "\n"
}
)
}
Would you be able to take a look at this and help me out?
Thanks in advance!
Comments:
Ariel Aguilar commented on 28 July 2021
Hi Svein,
For this case, this should work:
if (executionInstanceName == "JIRACLOUD") {
def includeComments = commentHelper.mergeComments(issue, replica).collect{it}
issue.comments = nodeHelper.toMarkDownComments(includeComments)
}
if (executionInstanceName == "ZD") {
replica.comments = replica.comments.findAll{!it.internal}
issue.comments = commentHelper.mergeComments(issue, replica, {
comment ->
comment.internal = true
comment.body =
comment.author.displayName +
" commented: \n" +
comment.body + "\n"
}
)
}
Let me know how it goes!
Kind regards,
Ariel
Chris Lord commented on 29 July 2021
Hi Ariel Aguilar ,
Please note that I am following up as Svein is on leave.
I have implemented the following code.
if (executionInstanceName == "Payments") {
def includeComments = commentHelper.mergeComments(issue, replica).collect{it}
issue.comments = nodeHelper.toMarkDownComments(includeComments)
}
if (executionInstanceName == "CS") {
replica.comments = replica.comments.findAll{!it.internal}
issue.comments = commentHelper.mergeComments(issue, replica, {
comment ->
comment.internal = true
comment.body =
comment.author.displayName +
" commented: \n" +
comment.body + "\n"
}
)
}
However I am still receiving an internal comment on Zendesk when an internal comment is left by an agent on Jira.
For clarity, Payments is Jira and Zendesk is CS.
Please let me know if you see anything wrong.
Thanks,
Ariel Aguilar commented on 29 July 2021
Hi there,
If you try this:
if (executionInstanceName == "Payments") {
def includeComments = commentHelper.mergeComments(issue, replica).collect{it}
issue.comments = nodeHelper.toMarkDownComments(includeComments)
issue.comments = issue.comments.findAll{!it.internal}
}
if (executionInstanceName == "CS") {
issue.comments = commentHelper.mergeComments(issue, replica, {
comment ->
comment.internal = true
comment.body =
comment.author.displayName +
" commented: \n" +
comment.body + "\n"
}
)
}
Let me know if only public comments are sent now.
Kind regards,
Ariel
Chris Lord commented on 30 July 2021
Hi Ariel,
Thanks for the help.
I have implemented the recent script, clicked on the save button and published changes.
I then made a public and internal comment on Jira as per the screenshot below.
When checking Zendesk it still receiving the internal comment from Jira and sending it as an internal comment on Zendesk.
Can you see anything wrong with here or have any suggestions on the scripting I can try out next.
Appreciate your help on this.
Thanks
Svein Tvedt commented on 03 August 2021
Hi Ariel Aguilar
Just bumping the thread, thanks