Automation rule returning "Error occurred setting field 'priority'. It will be ignored. (priority)"
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When trying to adjust the 'Priority' from an issue through an Automation for Jira rule, you may encounter the following result on the Audit logs:
Using the base level logging of Jira, nothing will be shown on the atlassian-jira.log.
Cause
This problem occurs due to a NullPointerException, when updating the issue 'Priority' through a REST request (also how A4J applies its changes) if the current Priority value is 'null'.
This is caused by the known Jira bug
-
JRASERVER-42570Getting issue details...
STATUS
.
As documented in the bug, it can be reproduced by having the 'Priority' field hidden on the Field configuration for that specific project, which causes the value for newly created issues to be set as 'null' on the database.
Diagnosis
You can confirm that this is indeed the case for your instance by either:
- Increasing the logging sensitivity to INFO for the 'com.codebarrel' class, and reproducing the problem.
Or by directly checking the 'priority' column for the affected issue on the 'jiraissue' table.
You may utilize the following query to look for the specific issue on the database (the query was created and tested using Postgres):SELECT CONCAT(project.pkey,'-',jiraissue.issuenum) as IssueKey, priority FROM jiraissue JOIN project ON jiraissue.project = project.id WHERE CONCAT(project.pkey,'-',jiraissue.issuenum) LIKE '<Issue_Key>';
Solution
Ensure that the Jira issue 'priority' is not set with a 'null' value on the database.
For the already existing issues:
- Use a JQL query to find issues that have a priority = null
- Bulk edit those issues and set a Priority level
- Test your automation.
Preventing future occurrences:
- Go to gear Jira administration (gear icon) > Issues > Field configurations.
- Locate the Field Configuration for the affected project.
- Click on the Configure link for the appropriate Field Configuration.
- Make the 'Priority' field visible by Clicking on Show.
- Test your automation.