Synchronization of internal and external comments

Originally asked by Fran Sánchez on 27 January 2022 (original question)


How can I synchronize from Jira Service to Zendesk an internal comment as an internal comment, and a public comment as a public comment?

So far the only thing I know how to do is to pass all public and private comments from Jira as internal to Zendesk. How do I make that difference?

Thanks!


Answer by Francis Martens (Exalate) on 27 January 2022

Hi Fran Sánchez

Checkout the How to manage comment visibility document
Just set the comment.internal to true or false.

(this is for scripted connections)


Comments:

Fran Sánchez commented on 27 January 2022

Thank you very much for your reply.

Yes, I checked it, but I don’t see how to make the comparison to determine if what I get is an internal or external comment and then apply true or false to the attribute.

I have tried several things, but it does not work:

issue.comments = commentHelper.mergeComments(issue, replica, {
  comment ->
   if (replica.internal) {
    comment.internal = true
   }else{
    comment.internal = false       
   }
    comment
  }
)

Where is the error?

Best regards

Fran Sánchez commented on 27 January 2022

any idea Francis Martens (Exalate)?? thanks for the help!!

Francis Martens (Exalate) commented on 27 January 2022

It is always handy to know what the cause of the problem is.
What you need to know is what the value of replica.internal is.

One way of doing so is to add in your code a debug statement which will raise an error showing the information you need to know

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


debug.error("The value of replica.internal is ${replica.internal}")
   if (replica.internal) {
    comment.internal = true
   }else{
    comment.internal = false       
   }
    comment
  }
)

And then trigger an incoming sync. And review the output of the debug statement …

I guess that replica.internal doesn’t exist.

Fran Sánchez commented on 27 January 2022

Thank you very much for your response. I was unaware of the debugging option. It is perfect.

Once tested I confirm that indeed replica.internal is null. However I have debugged the replica.comments of the Jira outgoint sync and despite having public and private comments I see that everything comes out as public. So it is logical that Zendesk cannot differentiate between private and public.

Why is this? I attach the image in which you can see that I have in Jira public and private comments, the image of the lines that I am debugging and part of the debug result where you can see that all comments: @internal= `false`.

Outgoing sync in Jira:

replica.comments    = issue.comments
debug.error("The value of comments is ${replica.comments}")

Comments private and public in Jira:

Result of the debug:

BasicHubComment{@body=`new12`, @id=`10229`, @remoteId=`null`, @author=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, @created=`Thu Jan 27 08:56:21 UTC 2022`, @updateAuthor=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, @updated=`Thu Jan 27 08:56:21 UTC 2022`, @group=`null`, @role=`null`, @internal= `false`, @executor= `null`}, BasicHubComment{@body=`newpublica`, @id=`10230`, @remoteId=`null`, @author=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, @created=`Thu Jan 27 09:02:45 UTC 2022`, @updateAuthor=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, @updated=`Thu Jan 27 09:02:45 UTC 2022`, @group=`null`, @role=`null`, @internal= `false`, @executor= `null`}, BasicHubComment{@body=`new interna`, @id=`10231`, @remoteId=`null`, @author=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, @created=`Thu Jan 27 09:02:50 UTC 2022`, @updateAuthor=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, @updated=`Thu Jan 27 09:02:50 UTC 2022`, @group=`null`, @role=`null`, @internal= `false`, @executor= `null`}, BasicHubComment{@body=`responder al cliente`, @id=`10232`, @remoteId=`null`, @author=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, @created=`Thu Jan 27 14:51:10 UTC 2022`, @updateAuthor=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, @updated=`Thu Jan 27 14:51:10 UTC 2022`, @group=`null`, @role=`null`, @internal= `false`, @executor= `null`}
Francis Martens (Exalate) commented on 27 January 2022

The rest api of Jira reports all comments as public whenever the request type is not set …

Is the request type set on the JIra side?

Fran Sánchez commented on 27 January 2022

I thi think so, it’s the green icon next to the ticket ID, isn’t it? or am I wrong?

Fran Sánchez commented on 27 January 2022

I think I have found the solution here. I will try it and confirm:

https://community.atlassian.com/t5/Jira-Service-Management/Service-Desk-Request-Type-always-blank-when-issue-created-by/qaq-p/911928

https://confluence.atlassian.com/jirakb/customer-request-type-displays-no-match-in-jira-859463969.html

Francis Martens (Exalate) commented on 28 January 2022

This is an example of a request type set

on Jira Server

On Jira cloud

Can you check and confirm

Fran Sánchez commented on 01 February 2022

Hello, that was the problem. Once I assigned a request type to the tickets I have already been able to differentiate between public and internal comments later in Zendesk for what I needed. thank you very much for the help provided!