How to Synchronize a Resolution Field in Jira On-premise

    This article shows how to synchronize the issue resolution field in Jira.

    Introduction

    Whenever you need to sync the resolution, you have to ensure that the resolution from the remote side is mapped to the local resolution objects.

    Source Side

    Add the code below to the Outgoing sync to send a resolution to the other side.

    replica.resolution = issue.resolution

    Destination Side

    Add the code below to the Incoming sync to set the resolution for the synced issue, based on the source side data.

    if (replica.resolution == null) {
       // if the remote issue is not resolved
       issue.resolution = null
    }
     
    if (replica.resolution != null) {
       // the remote issue is resolved, but the local isn't - look up the correct local resolution object.
    
    
       def resolutionMap = [
            "Done" : "Done",
            "Won't Do" : "Won't Do",
            "Known Error" :  "Won't Fix"
       ]
       // use 'done' as resolution if the remote resolution is not found
       def targetResolutionName = resolutionMap[replica.resolution.name] ?: "Done"
       
       // nodeHelper.getResolution looks up the local resolution object based on the provided name
       issue.resolution = nodeHelper.getResolution(targetResolutionName)
    }

    You can also just hardcode a resolution by name:

    if (replica.resolution == null) {
       // if the remote issue is not resolved
       issue.resolution = null
    }
     
    if (replica.resolution != null) {
       issue.resolution = nodeHelper.getResolution("Fixed")
    }