Introduction
This article addresses a common issue encountered when utilizing a database picker field in Jira, specifically the appearance of a “- null” string at the end of dropdown selections during editing. We’ll outline the problem, analyze the root cause, and provide a straightforward solution.
Main Content
The problem involves a database picker field that, while functional, displays a trailing “- null” within the UI when a value is selected from the dropdown. This occurs solely during the field’s edit mode and disappears when the value is actually saved. The underlying SQL query, as shown in the provided configuration, appears to be generating this string when handling null or empty values in the `INITIATIVE_NAME` field.
The solution, as suggested by Tuncay Senturk, involves modifying the `renderOptionHtml` function. Specifically, replacing the “No Name” string with an empty string (“”) resolves the issue. This eliminates the trailing hyphen and ensures a clean display of the selected initiative ID and name. The corrected function is: `renderOptionHtml = {String displayValue, GroovyRowResult row ->def init_id = row[1]?.toString() ?:””def init_name = row[2]?.toString() ?:””$init_id – $init_name”}`.
Conclusion
By adjusting the `renderOptionHtml` function to handle null values gracefully, the “- null” string is eliminated from the database picker field’s display. This simple change provides a clean and accurate representation of the selected initiative data, resolving the reported issue.
Source: https://community.atlassian.com/forums/Jira-questions/Database-picker-field-showing-null-at-the-end-of-drop-down/qaq-p/2894225
Leave a Reply