Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

How to connect issues using a workflow transition

 
2
1
0

One of our users asked if it would be possible to hide the sync status panel on Jira cloud for certain users.
The current feature to hide it for everyone except for the administrators does not work, because non admin users should be able to connect issues to each other, and this is only provided through the sync panel





The topic about the conditions to hide the sync panel is drawing some interesting discussions, because there are many conditions that define when the sync panel should be hidden or not.   For instance the other community question How to hide exalate button/field for projects that are not using exalate - Jira Cloud
and a couple more.

The approach provided by Daniel Carvajalwould work fine to exalate issues, but not to connect issues.
So how can this be implemented using a transition?


    CommentAdd your comment...

    2 answers

    1.  
      2
      1
      0

      One of the capabilities of the incoming sync script is to build twins between existing issues.  
      Whenever the issue.id is set during the firstsync - exalate, will not create an issue, but connect the remote with the local

      Following code will associate the incoming twin with the issue with id 12345

      if (firstSync) {
         issue.id = 12345 as Long
      }



      Based on this knowledge it is straightforward to build the logic as detailed in following video





      The code to associate is


      Some explanations


      • Line   1 - 11 : instantiate the classes which are required to do a search.  This is specific for Jira OnPrem
      • Line 16.       : Check if the incoming message has a custom field 'Target issue key' set
      • Line 17 - 19 : Search for the local issue key.
      • Line 21 - 24: Don't do anything if the issue key is not found - the twin will not be buiit
      • Line 26.       : assign the found issue, such that exalate knows that an issue needs to be connected
      • Liine 27.       : Just set any type (which exists in the target project - this is a small bug in the logic - the setting is ignored
      • Line 28 - 31 : In case the target issue key is not set, then create a new issue in project AN and the appropriate type


      (warning) some advice - 
      It is possible to link multiple source issues to the same target issue - but there might be unwanted effects, like when one source issue is updating its summary, the other source issue summary also gets updated.



      The source code itself can be found as a snippet here

             

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi Francis Martens (Exalate) - how could we accomplish the same thing but connecting from Jira DC to Jira Cloud? 

          CommentAdd your comment...