Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner: Make mandatory custom fields empty on the issue creation screen

Balazs_Devay
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 8, 2026

I want to implement a feature.

 

GIVEN

- custom, mandatory field (multi-select drop-down list): CMF, and

- CMF is presented on the creation screen and visible, and

- Script Runners - Behaviours is available

WHEN

- the user creates a new Jira work item, and

- the default work item (A) is selected automatically, and

- user selects a different issue type (B) on the creation screen

THEN

- the value of the CMF is reset to empty

 

I tried the following, but these trials all fail without throwing an exception, but UI displays the error: "We encountered an error while applying UI modifications to this form"

- CMF.setValue(null);

- CMF.setValue("");

- CMF.setValue([""]);

 

I also tried this but it didn't help:

CMF.setRequired(false)

CMF.setValue(null);

CMF.setRequired(true)

 

Update:

The core observation is that an empty value in a mandatory field is supported during creation by design: when the creation screen opens, the field is empty until the user populates it, and validation only occurs at submission. This demonstrates that “empty” is a legitimate intermediate state for a mandatory field on the create screen.

The inconsistency arises only when the field has been programmatically assigned a value. From that moment on, returning the field to the very same empty state that existed seconds earlier is rejected by the UI modification layer. In other words, the platform accepts “empty” as an initial state but refuses to accept “empty” as a transition state, even though both are functionally identical from the user’s perspective and from the validation standpoint. This asymmetry is what leads me to classify the behaviour as a bug rather than a design constraint.

Making the field optional at the Field Configuration level is unfortunately not a viable option in our context. The field is shared across a large number of projects and used by thousands of people, so altering its configuration would have a much broader impact than the local behaviour we are trying to implement. Similarly, deferring enforcement to a workflow validator changes the user experience significantly and does not address the underlying inconsistency.

From a logical standpoint, restricting a script or behaviour from clearing a mandatory field does not provide any real safeguard. The user is already able to clear the field manually at any point before submission, and the mandatory constraint is enforced only at the moment of submission. Allowing automation to perform the same operation that the user is permitted to perform manually would therefore not weaken the validation model in any way; it would simply make the two paths consistent.

 

 

1 answer

0 votes
Prasanna Ravichandran
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 9, 2026

Hi,

Mandatory fields in Jira cannot always be reset to empty dynamically during issue creation, especially when the field is marked as required in the Field Configuration.
With ScriptRunner Behaviours, clearing a visible mandatory field often causes the UI modification error you are seeing.
A better approach is to keep the field optional during create and enforce it later using a Workflow Validator or transition screen based on the issue type/status. Hope this helps.

Balazs_Devay
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 10, 2026

Thank you for the suggestion. I would, however, like to push back on the recommended approach and share why I believe the current behaviour points to an inconsistency in the platform rather than an expected limitation.

The core observation is that an empty value in a mandatory field is supported during creation by design: when the creation screen opens, the field is empty until the user populates it, and validation only occurs at submission. This demonstrates that “empty” is a legitimate intermediate state for a mandatory field on the create screen.

The inconsistency arises only when the field has been programmatically assigned a value. From that moment on, returning the field to the very same empty state that existed seconds earlier is rejected by the UI modification layer. In other words, the platform accepts “empty” as an initial state but refuses to accept “empty” as a transition state, even though both are functionally identical from the user’s perspective and from the validation standpoint. This asymmetry is what leads me to classify the behaviour as a bug rather than a design constraint.

Making the field optional at the Field Configuration level is unfortunately not a viable option in our context. The field is shared across a large number of projects and used by thousands of people, so altering its configuration would have a much broader impact than the local behaviour we are trying to implement. Similarly, deferring enforcement to a workflow validator changes the user experience significantly and does not address the underlying inconsistency.

From a logical standpoint, restricting a script or behaviour from clearing a mandatory field does not provide any real safeguard. The user is already able to clear the field manually at any point before submission, and the mandatory constraint is enforced only at the moment of submission. Allowing automation to perform the same operation that the user is permitted to perform manually would therefore not weaken the validation model in any way; it would simply make the two paths consistent.

Given the above, could you confirm whether this is recognised as a known bug, and whether there is a supported technique within Behaviours to set a mandatory field back to its initial empty state on the create screen? If no such technique exists today, I would appreciate guidance on where to raise this as a defect or improvement request.

FYI-we use Jira Cloud. 

Suggest an answer

Log in or Sign up to answer