2
1
0

We are using a workflow scheme in Jira whereby we have 2 different workflows associated with specific issue types.

E.g. workflow A is associated with Epic and Story, workflow B is associated with Bug and Improvement issuetypes.

But for the sync activities via Exalate sync add-on we only use issuetype Bug.

In our incoming groovy script we have created mapping rules for statuses, and target statuses refers only to statuses of workflow B.

The sync add-on for Jira chooses a workflow context when trying to sync status change. But the workflow context (workflow A) is not the right workflow for issue type B, and the mapped statuses in the incoming groovy script do not belong to workflow A but to workflow B. Now the mapping of statuses will fail as they do not exist in context workflow A.

How can I create a rule condition where the issue type defines the chosen workflow context?

Thanks in advance.

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Nico Paffen

      To accomodate multiple workflow mappings, what you can do is as follows in the incoming sync.
      Note YMMV - so you will have to do some experimentation.  


      Incoming sync - untested
      def statusMapForEpicAndStory = [
           "Open" : "Open",
           "Waiting for development" : "In Progress",
           "In Review" : "Resolved",
           "Closed" : "Closed"
      ]
      
      def statusMapForBug = [
          "Open" : "ToDo",
          "In Progress" : "Doing",
          "Done" : "Done"
      ]
      
      
      // Choose the right status map depending on the local issue type
      
      def targetStatus
      if (issue.typeName == "Epic" || issue.typeName == "Story") {
         targetStatus = statusMapForEpicAndStory[replica.status.name] ?: "Open"
      } else {
         targetStatus = statusMapForEpicAndStory[replica.status.name] ?: "ToDo"
      }
      
      issue.setStatus(targetStatus)


      If using the visual editor, you will have to replace the standard status sync rule with a scripted, and ensure that the status is set on the right target.  Assume that your target short name is called 'myjira', the script would look like


      def statusMapForEpicAndStory = [
           "Open" : "Open",
           "Waiting for development" : "In Progress",
           "In Review" : "Resolved",
           "Closed" : "Closed"
      ]
      
      def statusMapForBug = [
          "Open" : "ToDo",
          "In Progress" : "Doing",
          "Done" : "Done"
      ]
      
      
      // Choose the right status map depending on the local issue type
      
      def targetStatus
      if (myjira.issue.typeName == "Epic" || myjira.issue.typeName == "Story") {
         targetStatus = statusMapForEpicAndStory[replica.status.name] ?: "Open"
      } else {
         targetStatus = statusMapForEpicAndStory[replica.status.name] ?: "ToDo"
      }
      
      myjira.issue.setStatus(targetStatus)
        CommentAdd your comment...