2
1
0

Assume you have a sync setup


A1 ---- Connection X ---- B1

A1 ---- Connection Y ---- C1


How  to configure the connections such that 

Whenever comments are  added to A1, these appear on B1 and C1

Whenever comments are added to B1 or C1, they should only be added to A1


Thanks,

Maya

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hi Maya, 


      The problem is that when a comment is added in C1, exalate will add the comment to A1, and this will trigger a sync with connection X and in turn sync that comment to B1 as well, what you could do is the following:


      Follow the instructions in the following link to impersonate comments https://docs.idalko.com/exalate/display/ED/How+to+impersonate+a+comment


      You can create an executor for both your connections, and in the incoming sync of the connection X you can add some logic to ignore comments made by the executor of connection Y and then in the incoming sync of connection Y add logic to ignore comments made by the executor of connection X.


      Let me know if this is clear.


      Thanks,

      André



      1. user-3fd1a

        André Leroy-Beaulieu Castro - I did forget about that angle - cool assist!


        Approach

        (this is a setup for a local sync, but it also works  whenever syncing over multiple instances)

        So mayathe approach  would be


        • Create 2 system users - connectionA and connectionB
        • On the incoming sync of connectionA use following code snippet in the incoming sync to merge the comments coming from the master



                         * line 19 - merge the incoming comments into the existing issue comments, but use a closure to specify how

                         * Line 21 - format the comment such that the real author and issue is visible 

                         * line 24 - set the executor to the user 'connectiona'


        • On the outgoing sync of connectionA use following code to ensure that only the right comments are included in the message

                         


                          * Line 20 - groovy goodness to collect all comments from the issue

                          * line 21, 22 - only include the comments which have been made by user 'connectiona' or by any other user which name doesn't contain 'connection'


        • Repeat this for connection B (replacing 'connectiona' username with 'connectionb')

        Why does this work?


        • The settings are ensuring that comments exchanged over connectionA  are either  the comments made by users, or the ones made by the user 'connectiona'
        • Whenever a comment is created in the incoming sync of  'connectiona', the author is set to 'connectiona'


        Oh boy


        It took me a while to understand how a solution could be implemented, so if you got your head dazzling, be assured - I got the same feeling  (smile)

        So - before you adventure into configuring this setup, you're welcome to access our test server where we developed the solution and validate that it works like you look for.
        Leave a comment below for getting access.  It will allow you to check the code snippets
        (note that it might be that the test environment gets recycled, so I can't assure eternal availability - yet ... you never know where science brings us.


      2. maya

        Hi André Leroy-Beaulieu Castro user-3fd1a,


        Thanks for your help!

        Unfortunately, it didn't work for me.

        Are you sure about the outgoing sync code?


        + I need to complicate a little bit this question (because it's not complicated enough (wink) )

        I have an external connection, in addition to that connection:

        Jira service desk cloud ---- Connection Z ---- A1

        As we already discussed, Whenever comments are added to B1 or C1, they should only be added to A1.

        I don't want that those comments will be synced into Jira service desk cloud, is the same manipulation should work for this?


        Thanks,

        Maya



      3. user-3fd1a

        Maya - I can provide you access to our test environment, so you can see how it works.

        Regarding the complication - no worries -  the approach ensures that the comments are only exchanged connectionX and connectionY

      4. maya

        Hi,


        Can you please help me to do the same in Attachments?


        Thanks,

        Maya

      5. user-3fd1a

        Is it  working for comments?

      6. maya

        For the local sync, it works.

        For the external sync, I still work on this (smile)

      7. user-3fd1a

        Regarding the attachments - it is similar -  but not completely the same, as attachments cannot  be impersonated.  Instead of the impersonation, you can change the filename on the target side.


        On the outgoing sync, ensure that only the attachments which needs to be synced are included in the message


        replica.attachments = issue.attachments.findAll { attachment ->
                                attachment.filename.contains("connectiona") ||
        						!attachment.filename.contains("connection")
                             }



        On the incoming sync, add the connection name to the filename before applying

        issue.attachments += replica.addedAttachments.collect {
                                     attachment ->
                                     attachment.filename = "connectiona_" + attachment.filename
                                     attachment
        }
      8. maya

        Thanks! the solution is good enough for me and works well.

      CommentAdd your comment...