Confluence has been updated to ver 6.15.9. In case of any troubles, please contact infra team.

Questions

 
1
0
-1

Env: JIRA cloud next-gen board, "Local synchronization"


In the Outgoing script, we can use findAll to select out what we want.

But sometimes the filter condition is not that simple, we have to do the filter in the "Incoming sync" script.


Use case:

We have 2 boards, "INT" for Internal and "EXT" for External.

Before we sync a ticket from INT to EXT, we want to make sure that all existing comments won't be synced.


So my code is like,

issue.comments = commentHelper.mergeComments(issue, replica, { 
    comment ->
    if (firstSync) {
        // no need to sync historical comments
        comment.body = '[HISTORY]'
    }
    comment
})


It turns all historical comments into "[HISTORY]" so that EXT users won't see the content.


But actually I don't want those historical comments to show up in EXT at all. I want to do something like "skip" or "continue", just exclude those special ones.


I tried set comment.body to "" (empty string) or null, it doesn't work.


What should we do?


Best regards,

Henry

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      At the moment there is not an easy way to avoid syncing the already existing comments before the exalation. I can see some workarounds:


      1. Instead of exalate, use the connect operation. That would mean that the issue needs to be created on the other side manually so it can be connected with the source. The connect operation, by default, doesn't include existing comments/attachments/worklogs.
      2. Get a custom field that represent the exalation date, make sure it gets filled by the incoming sync on first time. And then filter out comments that were created before that time.


      Would any of those make sense for you?

      Best regards,

      Juan

      1. Henry

        Hi Juan,


        Thanks for the workarounds suggestion!
        #1 is not workable for us because we have many tickets.
        For #2, a question is: how to "filter out comments that were created before that time"?
        If you mean doing this by "findAll" in outgoing script, how can I get the "first exalation time" of the twin ticket? And what about the first sync? When a ticket with 10 comments get exalated for the first time, there is no such "first exalation time" yet.

      2. Juan Grases

        Yes, we don't store the first exalation time. That's why the solution includes creating a custom field where this would be stored. This could be done on the receiving side:
        Incoming sync on receiving side:

        if(firstSync){
          issue.customFields."First Sync Date".value = new java.util.Date()
        }
        
        def firstTimeExalation = issue.customFields."First Sync Date".value
        replica.addedComments = replica.addedComments.findAll{it.created.getTime() > firstTimeExalation.getTime() }
        issue.comments = commentHelper.mergeComments(issue, replica)
        
        

        Of course this would require creating that custom field "First Sync Date" on the receiving Jira (which might be a hidden field I believe). We will evaluate internally the possibility to exalate to store internally the date of the first sync.


        Best regards,

        Juan

      3. Henry

        Thanks. Your team is the greatest team I've ever met.

      CommentAdd your comment...