Synchronize attachments in public comments in jira service as public in zendesk

Originally asked by Fran Sánchez on 01 February 2022 (original question)


Currently all the attachments that I synchronize from Jira Service are syncronized as public to Zendesk. is it possible that the private ones sync as private and the public ones as public? From what I have seen in the information that goes out of Jira I do not see what attribute I can use to differentiate between one and the other?

BasicHubAttachment{id=10061, remoteId=`null`, mimetype=`image/png`, filename=`normon_WC.png`, created=`Tue Feb 01 10:57:21 UTC 2022`, filesize=`77022`, author=`{ @key : 70121:9c815981-e9a2-45bd-af56-2d60fee20b8a}`, thumbnailable=`null`, zip='false'}] 

Thanks for the help


Answer by Fran Sánchez on 01 February 2022

In case it helps I found the solution by placing the following code in the incoming sync part of Zendesk:

if(replica.addedComments.reverse().find()?.internal == true && !replica.addedAttachments.empty){
        replica.addedAttachments = replica.addedAttachments.collect{
            attachment ->
            attachment.internal = true;
            attachment
        }
}

issue.attachments = attachmentHelper.mergeAttachments(issue, replica)