It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Read only field- only in view screen

Hi,

 

I need to made a text field 'read only' only in edit screen (The user can change this field in the edit and create screen).

 

BR,

Daniel

2 answers

1 accepted

1 vote
Answer accepted

Um, your question says "make text field read-only in edit screen" then "the user can change this field in edit screen" - which one is it? 

Or do you mean you just want to be able to stop all edits of the field after creation?  (To do that, remove it from the edit screen)

Hii @Nic_Brough__Adaptavist_

I mean this:

In the create screen user can put value in this field.

In edit screen- user can change the value and update this field.

In view screen- the field will be read only (If the user wants to change, he will need to press the 'Edit' bottom).

Ah, ok.  You have a problem then - the standard way to tell Jira a field cannot be edited in "view" is to remove it from the edit screen.  The "inline edit" is a friendly way of making Jira quicker and easier for your users - changing a field becomes three clicks instead of 6.

If you want to disable inline edit while keeping the ability to change a field then consider these:

  • Don't - inline edit is useful, and most people use it well.  New users who have used Jira before will find this restrictive, intrusive and annoying.
  • Move the edit of the field into the workflow - remove it from the edit screen, but put it on transition screens that prompt users as they move through the flow.  This also has the advantage that you can limit who can edit the field.
  • Use Behaviours in the ScriptRunner app to block inline edit for the field

Thank you @Nic_Brough__Adaptavist_ ,

How can I do the third bullet? I can make a field 'read only' , but at all of the screens (view + edit).

I would like to 'read only' only in inline edit (view screen)

Ok, use a Behaviour that is an "initialiser" and says

def descField = getFieldById("description")
descField.setAllowInlineEdit(false)

Thanks! Works like a charm :) 

@Nic_Brough__Adaptavist_

is possible to put a customfield in the transition but in only read, only in the transitions that I need, but in JIRA CLOUD, not in Server.

Thank's

No.  If you put a custom field on a transition screen, it is there to be edited by the user, not read-only.  Behaviours can change that, but Cloud does not support the type of code Behaviours needs to inject to do this (yet), so there are no behaviours for Cloud.

@Nic_Brough__Adaptavist_ behaviour seems to have an issue where the scripts kicks in rather slow. If you are fast enough to click the field <3 sec, the inline edit would still be available. :/ 

@Nic Brough - thank you for your involvement in the Community. With Jira 7.9.2 and Scriptrunner 5.6.9, I can't seem to disable inline editing on view screen, for a custom date picker field, using the simple 2 lines above with an initializer. It remains editable on view screen in the Dates section. Would you expect this to work for a date picker?

I am also unable to get this to work on a simple text field.

def logField = getFieldById("customfield_10235")
logField.setAllowInlineEdit(false)

I am sure I am grabbing the right field as I have been able to get the setHidden() and setReadOnly() functions to work on it.

0 votes
Joe_Pitt Community Leader Jan 16, 2019

If they can edit the field then it isn't defined as read only. If you are setting it in the background remove it from the edit and view screens. If you don't have separate create, edit, and view screens you need to create them instead of just using the default screen for all functions. 

Hi @Joe_Pitt ,

In view screen- the field will be read only (If the user wants to change, he will need to press the 'Edit' bottom)...

Is it possible ?

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you