Change custom field to read only by script runner

When assignee changes I change the value of a custom field by using Adaptavist scriptrunner (I parse the company part from user email). But I need the field not to be edited by the user (only the script should update the field content).

Is it possible to make something like below:

1- make field read-only false

2- update field value

3- make field read-only true

I searched com.atlassian.jira.issue package but no such method like setReadOnly(boolean)

2 answers

1 accepted

0 votes
Accepted answer

I solved the issue by setting a behaviour to make the field read only.

The field appears in both view and edit screens but thats not problem because it is read only.

Thank you both for your answers.

Not sure why you think this is the right answer, when all you needed to do was what MoroSystems said.



There is a simple way to do it - put the field on View screen of the issue and don't put the field on Edit screen of the issue. Users will see the field, but will not be able to change it manually.


Simply because fields, which are not present on Edit screen have the ability to click-and-edit disabled for them and they are not present on any screen, which can edit them.


Scriptrunner should be able to edit them anyway.


The field is not visible when it is present only on the view screen. I can see it when I add it to the edit screen also.

More info:

I'am listening the issueAssigned event. Then editing the custom field value. The script always says that the run was successful.

Your field must have data in it before it will appear on view, so you won't see it until the script has run.

You'll need to take another look at the script - I don't know how you are judging "run is successful", but to me that just means you know the script has run, not that has actually done what you want it to.

The script should not have any impact on the basic behaviour of JIRA.

I have just tested this on newest JIRA and it works just the way I told you and I was even able to modify custom field's text trough ScriptRunner without being able to edit it myself trough JIRA itself.


Could you please try to reproduce these steps:

1. Add new custom field to JIRA (make it e.g. test_custom_field and make it single line text field).

2. Put it on the View issue screen and Create issue screen, which differ from Edit issue screen for that particular issue and project

3. Create new issue and on creation issue screen, the field should be presented. Type any value in it.

4. After creation is completed, take a look on the issue, you newly custom created field should be here Note that you must have a value in the field to make it appear on View screen. The field is non editable and when you press "Edit" button, it is not presented on this screen.

For me, it works perfectly this way, even if I don't add it to Issue Creation screen.


If you are not sure about other things impacting behaviour of screens, you can try it on newly created test project.

Hi Nic,

Ok. I understand the second part of your answer.

The problem is with the first part. No matter how many times I change the assignee (the script runs that many times), I cannot see the custom field on view screen. When I add it to the edit screen also then it becomes visible (with data in it).

To test this behavior I followed the below steps:

1- Wrote the script under script listeners (custom)

2- Added the custom field (text) to the view screen only

3- Created an issue in the related project

4- Changed the assignee many times

5- "Nothing happened. The field is not visible on view screen"

6- Added the custom field to the edit screen also

7- I expected to see the field because I thought that the field value was filled before (by the previous runs of the script). But the field was not visible.

8- Changed the assignee

9- The field became visible on the view screen

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,917 views 19 22
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you