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

customField.setAllowInlineEdit(false) is not working in Behaviour

Dan27 June 29, 2020

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

Suggest an answer

Log in or Sign up to answer
0 votes
Mathis Hellensberg
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.
June 29, 2020

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

Dan27 June 30, 2020

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

Mathis Hellensberg
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.
July 1, 2020

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.

Dan27 July 1, 2020

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....

Mathis Hellensberg
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.
July 1, 2020

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

Dan27 July 1, 2020

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.

Mathis Hellensberg
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.
July 1, 2020

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
Alejandro Suárez - TecnoFor
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 2, 2020

@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
0 votes
Mathis Hellensberg
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.
June 29, 2020

Hi @Dan27

Wouldn't customField.setReadOnly(true) work?

Cheers!

Dan27 June 29, 2020

Hi @Mathis Hellensberg 

No, I still can change FixVersion value from view screen

Mathis Hellensberg
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.
June 29, 2020

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

Dan27 June 29, 2020

@Mathis Hellensberg 

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

 

OR

 

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

TAGS
AUG Leaders

Atlassian Community Events