We have a requirement in Exalate Sync for Attachment. Attachment should be copied to remote side only when added in Customer Portal or added in comment that is shared with customer. if a user added attachment directly using edit screen in Jira software or added attachment in Internal comment then the attachment should not be copied to remote side. i.e. Attachment which are viewed by customer only should be copied to remote side. presently all the attachments are copied to remote side. Please suggest a way to restrict attachments which are only viewed by agents to be copied to remote side.
Great question, Prasad! You can achieve this selective attachment syncing in Exalate by customizing your sync rules using Script mode. The idea is to filter attachments based on their context—whether they were added via the customer portal, or in a public comment, versus those added internally or in internal comments.
Here’s a practical approach:
Identify the context of the attachment:
Attachments added via the Jira Service Management (JSM) customer portal or in public comments are typically visible to customers.
Attachments added directly to the issue or in internal comments are not customer-visible.
Customize your outgoing sync script:
In your Jira sync rules, you can filter attachments by checking their association with public comments or portal actions.
For attachments in comments, you can check if the comment is public (comment.public == true).
For attachments added directly (not via comments), it’s trickier, as Jira doesn’t natively tag attachments with their source. However, you can often infer this by only syncing attachments referenced in public comments.
Here’s a sample snippet for your Jira outgoing sync script:
// Only sync attachments referenced in public comments
def publicAttachments = []
issue.comments.each { comment ->
if (comment.public) {
comment.attachments.each { att ->
publicAttachments.add(att)
}
}
}
replica.attachments = publicAttachments
If you want to include attachments added via the customer portal (not just in comments), you may need to use a custom field or automation to tag such attachments, as Jira’s API doesn’t always distinguish the source.