Introduction

You need to map two workflows. Issues get raised at the customer site, exalated to the software vendor, who handles the issue and resolves it.

The workflows on either end are using global transitions which allows you to progress an issue to a particular status, whatever the original status is.  

For this example, we have set up the following workflows one on the customer side, the other on the software vendor end.

Customer workflow

Software Vendor workflow

The intended status mapping should be:

Customer StatusSoftware Vendor Status
AnalysisDone
ExalatedTo Do
Under DevelopmentIn Progress
To ReviewDone
DoneDone

 

How does this work?

Whenever the software vendor changes the status of the synced issue, the status change is applied by looking up the corresponding target status in the statusMap, and assigning it to the issue.doTransition. In case the remote status is not set (because it is not provided by the software vendor), or if the mapping cannot be found, nothing happens, except for a comment being added to the issue.


To implement this mapping, add the snippets below to the Change Processor.

This configuration works if every transition in the workflow is a global transition.

On the customer side


// the transitionmap maps remote statuses to transitions which needs to be activated locally
def transitionMap = [
  "To Do":"Exalated", 
  "In Progress":"Under development", 
  "Done":"To Review"
]

/* transition the issue to the corresponding status.  
** If the remote status is null or the status is not found in the map, 
** add a comment to the issue such that the configuration can be adapted.
*/

if (replica.status == null || 
    replica.status.name == null || 
    transitionMap.get(replica.status.name) == null) {
  issue.comments = commentHelper.addComment("Remote status is unknown or cannot be mapped - can't handle it", issue.comments)
} else {
  workflowHelper.transition(issue, transitionMap.get(replica.status.name))
}

 


 

On the software vendor side

The Connection on the software vendor side is similar, except for the mapping



// the transitionmap maps remote statuses to transitions which needs to be activated locally
def transitionMap = [
  "Exalated":"To Do", 
  "Analysis":"Done", 
  "Under development": "In Progress",
  "To Review":"Done",
  "Done":"Done"
]

// transition the issue to the corresponding status.  
// If the remote status is null or the status is not found in the map, progress issue to in review
if (replica.status == null || 
    replica.status.name == null || 
    transitionMap.get(replica.status.name) == null) {
  issue.comments = commentHelper.addComment("Remote status is unknown - can't handle it", issue.comments)
} else {
  workflowHelper.transition(issue, transitionMap.get(replica.status.name))
}