Forums

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

ScriptRunner Behaviour makes fields disappear

Jonathan Porta
Contributor
March 31, 2026

Hello,

I'm trying to use Behaviour on a Jira Cloud instance. I know that they can have issues with JSM project but in this case, I configured my behaviour to work on a Software project.

 

The issue I have now, is that my behaviour is properly triggered, the value are properly tested, but when I use a SetReadOnly(true) on a field, it makes it disappear!

 

I know that rendering of additional custom fields can lead to that, but in this case it is a native Jira user picker.

 

Have anybody encountered a similar issue? Is there a fix/work-around?

 

Thanks in advance.

3 answers

Suggest an answer

Log in or Sign up to answer
3 votes
Gor Greyan
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.
March 31, 2026

Hi @Jonathan Porta

Thanks for the question.

As a workaround, I suggest that, instead of making the field read-only, you can keep it visible using setHidden(false) and control behavior via validation (e.g., prevent changes or reset the value if modified).

def field = getFieldById("customfield_xxxxx")
field.setHidden(false)

 

Jonathan Porta
Contributor
March 31, 2026

Thanks for your answer.

In Jira cloud, there is no such thing as setHidden. Strangely, it is setVisible...

I have tried to force that property at the same time I put setReadOnly, but the field still disappears.

How can I reset the value if modified? It would be better than nothing...

 

Is that a known issue? Should I open a ticket to ScriptRunner?

Gor Greyan
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.
March 31, 2026

Dear @Jonathan Porta

For resetting the value, you can do something like:

def field = getFieldById("customfield_xxxxx")
def originalValue = field.getValue()
field.setFormValue(originalValue)

Yes, I think you can raise this with Adaptavist; it is likely a bug in how Cloud Behaviours interact with the new issue view.

mr john
Contributor
March 31, 2026

Hey! I’ve run into something similar with Behaviours on Jira Cloud. Often when SetReadOnly(true) causes a field to disappear, it’s related to how Jira renders native fields versus custom fields. Even though it’s a native user picker, Jira sometimes hides it if it thinks the field isn’t editable in that context.

A few things you could try:

Use setFormValue() before setting it to read-only to ensure the field has a value.

Wrap the SetReadOnly(true) in a small timeout or use onFormReady to make sure the behaviour triggers after the form fully loads.

Double-check any field context or screen configurations sometimes certain screens automatically hide read-only fields.

Would love to hear if anyone has a cleaner workaround these quirks can be tricky!



Like Gor Greyan likes this
2 votes
Arkadiusz Wroblewski
Community Champion
March 31, 2026

Hello @Jonathan Porta 

We can quess longer, but you should open a ScriptRunner support ticket and include a small reproducible example, plus whether this happens on Create, Issue View, or both, and whether the field is empty when the behaviour runs.

They have tons of Specialist which can help you directly.

Jonathan Porta
Contributor
March 31, 2026

Your comment helped a lot!

I didn't even think that having a value in the field would make a difference, but it does!

The field disappears when it is empty, but stays in read-only when there is a value. 

I have now better precisions to open a ticket, thanks!

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
April 14, 2026

Hi @Jonathan Porta

In your description, you mentioned:-

The issue I have now, is that my behaviour is properly triggered, the value are properly tested, but when I use a SetReadOnly(true) on a field, it makes it disappear!

Please clarify whether you have more than one Behaviour configuration. If so, could you please temporarily disable all other Behaviour configurations except the one mentioned in this ticket and see if it works?

This is to rule out a Behaviour conflict.

Also, please clarify, what language are you using to write your Behaviour code for the cloud? Are you writing it in Groovy or Typescript? If it's the former, it won't work as expected. For Jira cloud the correct syntax to be used is Typescript.

Below is an example code on how to set a field to read only via Behaviour:-

const field = getFieldById('customfield_12345')

field
.setReadOnly(true)

I am looking forward to your feedback.

Thank you and Kind regards,
Ram

 

 

Jonathan Porta
Contributor
April 14, 2026

No I have only one rule active. I disabled all the other behaviours and even uninstall JMWE live fields which was previously installed. I used pretty much the same code as your example.

If you look at one another comment in the topic ,you'll see that in fact my field disappears only when it is empty.  When I put a value in the field it correctly pass in readonly. I don't know if it is expected or not from the application...

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
April 15, 2026

Hi @Jonathan Porta

In your last comment, you mentioned that your field will disappear when it is empty.

Could you please clarify which view you are testing the Behaviour in? Is it the Create view or the Issue View?

If it is in the Issue View, could you please ensure the field is included in the Edit and View screens for that issue, and rerun the test to see if it makes a difference?

Thank you and Kind regards,
Ram

 

 

Jonathan Porta
Contributor
April 17, 2026

This is in the Issue view directly. I only have one screen for all operations for all the types in this project. The point is that I see the field disappearing. I see the block loading and once the behaviour is applied, if the field is empty, then the field disappears.

 

Should I open a ticket at Adaptavist directly?

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
April 26, 2026

Hi  @Jonathan Porta ,

Appologies for the delay in responding. I was OOO for a few days.

Before raising a ticket to the Adaptavist Support team, I need you to try something.

Please include the field in both the Issue View and Issue Edit screens and rerun the test.

In ScriptRunner for Jira Cloud's Behaviour, the field needs to be added to both the View and Edit screens for it to work as expected.

If it still fails even after adding the field to the Edit screen, it needs further investigation, and you should raise a ticket with ScriptRunner for Jira Cloud Support.

Thank you and Kind regards,

Ram

Jonathan Porta
Contributor
April 26, 2026

Hello, 

Thank you for your answer.

My screen scheme use the same screen for all operations on the types using the field:

screen.png

Is that what you mean?

 

Regards, 

 

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
April 29, 2026

Hi @Jonathan Porta

Yes that's what I am referring to.

Thank you and Kind regards,
Ram

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events