Cannot set priorities in Jira Cloud

Originally asked by Josiah Wang on 10 May 2021 (original question)


I cannot use the Exalate incoming sync groovy window to set priority.

On the outgoing sync in Zendesk, I have:
replica.priority = issue.priority

On the Incoming sync in Jira cloud, I have:
def priorityMap = [“low”: “Low”, “normal”: “Medium”, “high”: “High”, “urgent”: “Critical”]
def remotePriority = priorityMap[replica.priority?.name] ?: “Low”
issue.priority = nodeHelper.getPriority(remotePriority)

I have confirmed that “remotePriority” maps correctly to “Medium” when the Zendesk ticket is set to “normal”, but the issue that is created in Jira is always set to “Low” priority no matter what the Zendesk ticket priority is. I have tried deleting the “?: “Low”” default priority assigning section of code from the Incoming sync but that does not seem to have an affect. I have also confirmed that the atlassian-addons-project-access role is added to the “Edit issues” permission in the project.

I have also tried manually setting the priority with the line:

issue.priority = nodeHelper.getPriority(“Critical”)

But again, the issue is always created with the priority set to “Low.”


Answer by Josiah Wang on 11 May 2021

Figured it out. Turns out the priorities in Jira, e.g. “Critical”, were actually "Critical " with a space after the word, causing the map to not be able to match the priority in Jira.


Answer by Ostap Krutsko on 11 May 2021

I see. To investigate what is really coming in replica.priority.name you may put in the first line of your incoming script the next trick piece of code:

debug.error("replica.priority.name=" + replica.priority.name)

this way you’ll get an error with the text contained in replica.priority.name, and if you will not get an error - the incoming script was not run at all (why - this is a good question - and we will investigate it then).


Comments:

Josiah Wang commented on 11 May 2021

The incoming script is running:

com.exalate.api.exception.IssueTrackerException: replica.priority.name=high

Everything is mapping correctly, I just cannot set a priority. Somehow the Jira project default is overriding everything.

I spun up a second test Jira Cloud instance and the same code runs flawlessly. The second Jira Cloud instance has a default priority set as well, except somehow that project default isn’t overriding everything.

Answer by Ostap Krutsko on 11 May 2021

I think the cause of such behavior is what the incoming sync does not render when an issue is created in Jira. As I’ve understood, the data is sync from Zendesk to Jira Cloud, and when you change priority on Zendesk the relevant priority is set on Jira - that means the incoming script on Jira side was run. This script should be also run if you make Exalate operation “exalate” from Zendesk - then the new ticket on Jira will be created and priority should be set. But, if you just create an issue on Jira Cloud manually - the incoming script on Jira side, of course, will not be run. And if you make Exalate operation “connect” from Zendesk to Jira Cloud to couple two existed tickets - incoming script on Jira side will not be run too. So, clarify, please, what is your case?


Comments:

Josiah Wang commented on 11 May 2021

Nope, these issues are being created from the “Exalate” operation on the Zendesk side. The incoming sync simply isn’t setting the priorities in Jira Cloud.

I’ve tried hard-coding a priority in the incoming sync (issue.priority = nodeHelper.getPriority(“Critical”)), and that does nothing either.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.