Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

customField.setAllowInlineEdit(false) is not working in Behaviour

Hello,

 

I want to 'read only' field fixVersion in Jira.

In edit screen in is working okay, But in view screen it is not read only and users can edit it.

I tried to use this intialiser without success:

def customField = getFieldByName("Fix Version/s")
customField.setAllowInlineEdit(false)

 

What am I doing wrong?

Thank you,

Daniel

2 answers

Ahh I get it now. Just remove the field from the edit screen that will make it read-only. No need for behaviours :)

I dont want to remove this field... There isn't a different way to do it?

But you don't want people to edit it so why keep it on the edit screen? As far as I can tell from your description, fixVersion is set upon creation and shouldn't be edited after? If so fixVersion should only be on the view (so you can view it) and create screen (so you can set it upon creation), not on the edit screen (since it shouldn't be edited). That is the way to go :) Even if you could do it differently the result would be the same.

I have a condition on this field, only users from a specific group can edit it.

So, I need it in edit, in create and in view screens.

But in View screen, the script didn't work, and all of the users can update it....

I see. Then you should be able to add the field to your behaviour, make it Readonly and add a new condition for a certain role or user like so :)

Snipaste_2020-07-01_10-59-53.png

I did it, like I wrote from the beggining...

It is working great only in edit screen, not in view screen.

In view screen all of the users can edit this field.

Hmm wierd. Works fine here. I see the edit if i hover over the field, but i can't actually edit it..

Snipaste_2020-07-01_12-00-04.png

Like Mehdi Heydari likes this

@Mathis Hellensberg you only have to add the field in the behaviour. That forces the edit screen to pop up when you try to inline edit it. 

Like aligntechsupport likes this

Hi @Dan27

Wouldn't customField.setReadOnly(true) work?

Cheers!

Hi @Mathis Hellensberg 

No, I still can change FixVersion value from view screen

@Dan27 Hmm.. can you post the full behaviour script? :)

@Mathis Hellensberg 

def customField = getFieldByName("Fix Version/s")
customField.setReadOnly(true)

 

OR

 

def customField = getFieldByName("Fix Version/s")
customField.setAllowInlineEdit(false)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

🎨 Add some visual life to your templates

Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...

177 views 3 8
Read article

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