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.
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).
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.