2
1
0

Hello 


I've the following problem:

In project A a transition in testcase A1 a bug A2 automatically is created as a linked issue to testcase A1.
After this postfunction we need a new postfunction in A1 to exalate A2 with project B


Thanks in advance

Thomas

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Thomas,


      Here is a snippet you could use in your Outgoing script to automatically sync the bugs that are linked to a testcase, just make sure the names of the issue types is the same as in your Jira:


      //Outgoing:
      
      def exaCl = com.atlassian.jira.component.ComponentAccessor
          .pluginAccessor
          .getEnabledPlugin("com.exalate.jiranode")
          .getClassLoader()
      def exaSyncServiceClass = exaCl.loadClass(
      "com.exalate.api.trigger.ISyncInitiationService"
      ) 
      def syncService = com.atlassian.jira.component.ComponentAccessor.getOSGiComponentInstanceOfType(
          exaSyncServiceClass
      )
       def im = com.atlassian.jira.component.getIssueManager()
      
      if (issue.typeName == "Testcase") {
          replica.issueLinks.collect{ link ->
           def linkedIssue = im.getIssueObject(link.otherIssueId)
           if (linkedIssue.issueType.name == "Bug") {
              syncService.pair(
                linkedIssue.key, // specify the issue key you want
                connection.name // set the relevant connection name
              )
           }
        }
      }


      Thanks,


      André


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

        Can you use the 'Exalate Now' Postfunction and add it to the create transition of the bug?
        If that is not an option, you could also set a custom field on the bug, and exalate it using a trigger.
        Additionally you can test in the outgoing sync if an issue is linked to a testcase which is under sync by traversing the issue.links

        There are quite a bit of different options.


          CommentAdd your comment...