Map priority field values

Originally asked by Madhu on 04 February 2021 (original question)


We are syncing Jira Cloud with Jira Server. We have different Priorities for Different Jira’s.

Jira Cloud Priorities : 1 ,2 , 3, 4

Jira Server Priorities : Blocker , High , Medium , Low

I have to Map Cloud data with Server : 1 - Blocker , 2- High , 3-Medium , 4- Low.

Please suggest the Cloud Outgoing and Server Incoming Sync.

Thanks in Advance.


Answer by Madhu on 08 February 2021

This is how it works.

Server side Incoming Sync-→

def priorityMapping = [
// remote side priority <-> local side priority
“1” : “Blocker”,
“2” : “High”,
“3” : “Medium”,
“4” : “Low”
]
def priorityName = priorityMapping[replica.priority?.name] ?: “Low” // set default priority in case the proper urgency could not be found
issue.priority = nodeHelper.getPriority(priorityName)