How to make custom fields read only?

Travis Tai March 26, 2019

I create a Text Field (read only) field and use it in a project. I should be only able to change the field via code. However I can still edit the field via the edit screen. What is wrong for me? How to make it truly read only?

3 answers

2 votes
Chris Stival January 9, 2023

Hi All - I'm trying to do the same thing, whereby I want to have a calculated field to be read-only. I understand what I've read here, regarding having a read-only "View" screen, but my question is about the documentation linked above. That link refers to data center and server. When I read documentation for cloud it looks like "The Default Screen is used for the default issue operations for creating, editing or viewing an issue." This makes me think that with the cloud version, the Default screen is what we have to use for creating, viewing, and editing...and it isn't possible to separate these. 

Am I mistakenly thinking that there's a difference between cloud and on-prem with regard to making a custom field read-only?

2 votes
Rambabu Patina _Appfire_
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 Leaders.
March 26, 2019

Hi @Travis Tai , Welcome to the community.

Remove the field from the CREATE and EDIT screens and put the field in VIEW screen only.

Thanks,
Ram.

Travis Tai March 26, 2019

It may works, but what is the point for creating a field with read only option?

Tad Foster February 24, 2020

Perhaps it may be reading in a Date Time stamp from another application. Which is what I'm trying to do, but when I remove it from Edit, it removes the field from Create and View. :(

Ondřej Zienert March 27, 2020

Hi,

I have exact the same issue, if I remove the field from any screen → it is removed from all (VIEW, EDIT, CREATE)

Anyone know how to achieve the read-only field without doing any shenanigans?

This should be a basic functionality of custom fields...

Like # people like this
Jordan Janis August 31, 2020

Hi Ondřej,

You have to have two separate screens in the same screen scheme for this to work.  One screen can be the View screen and the other can be used for Create and Edit. 

One simple way to do it is to fins your screen in the list of screens in the Admin section, copy that screen and name it something like "<screen name> view-only screen", where <screen name> is the name of the original screen.

Then go to the project's screen scheme and associate the View issue operation with the new "...view-only screen".

Finally, configure the original screen to remove the field you don't want users to edit.  If the field is non-empty you will see it when viewing the issue. But you won't be able to click-on it to edit it, and it won't appear in the edit screen.

If you need some help around the configuration part, this should point you there: https://confluence.atlassian.com/adminjiraserver/associating-a-screen-with-an-issue-operation-938847289.html

Good luck!

Ondřej Zienert November 17, 2020

Hi Jordan,

thank you very much for your reply!

Kind regards, Ondrej

1 vote
Tad Foster March 27, 2020

I got this to work using Script Runner, and did these steps:

More info: https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html

Project: EXAMPLE

Custom Field: Required Fix Date

Issue Type used: Bug

This field is to be read-only written from EXAMPLE project.

Set up:

Go to Applications → Manage Apps → Behaviours (Left Nav bar)

  1. Add Mapping → EXAMPLE project & Issue Type = Bug
  2. Add Field → Required Fix Date

SAVE

Ondřej Zienert July 17, 2020

Hi Tad,

thank you very much for posting your solution with the howto guide.

I'll try to set the behaivour as you had and fiddle with it a little.

Cheers, Ondrej

Like Tad Foster likes this

Suggest an answer

Log in or Sign up to answer