Hi,
I am following these instructions from Atlassian documentation to set a custom field with an autocomplete renderer:
NB: I am using it on a select field and not on a multi-select field, and it works.
Yet, when I set a field optional, the "non"e option does not appear (and I would like to). Weirdly, this option appears when the field is required.
I tried to remove some lines in this code that remove "none" option, but it doesn't work.
Could someone help me to change this code please ?
Regards,
Camille
Hi Camille,
In this case, the option of 'none' does not actually represent any value at all. When you make a field required in Jira, it means that this issue has to always have a value of some kind for that issue. Which is why none won't work, it's not actually a value to be stored in the database for this field for that Jira issue. It's the equivalent of a NULL in the database. The None might have appeared even when the field is required, but you could not create the issue or leave that field blank when editing an existing issue in those cases, Jira will prompt you enter in some value here to be able to continue.
Since you have made it required, NULL values are not possible. As such I do not believe is possible for you to customize this script in this specific case. Even if you could, you would be typing in the word None and Jira still would not accept it because the field is required.
One solution would be to make the field optional or not required. In that case, you could likely continue to then edit the script and allow it to not remove that none place holder.
But I suspect that solution is undesirable here. So alternatively, you could try to edit the field itself to create a new default value called 'empty' or something like 'not set', or have any other default value for the field itself. But if you do this, those issues will at least have some value defined for them in that specific field at all times.
However you need to be careful when you change a custom field's context in Jira. It has the tendency to force you to potentially lose data in the process. Please see the details in Change Context for an Existing Custom Field Without Losing Old Data. It explains steps you can take within Jira to make sure that you don't lose data here. If you want to set change the context of this field for a specific project, it would be necessary to follow these steps so that there is no loss of data here.
I hope this helps.
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.