The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

what i can do to find define custom field readonly in a listener

fedribreakly
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 10, 2022

Hi Everyone,

 

I need to define custom field read only via listener.

i have a specific group that can edit a field,  I created a behavior and it works for jira well,  but we work with structure and in there the field is writable, I want to use listener to make the field read only, or add and remove the field from the screen 

 

Thanks!

Best Regards.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Nic Brough -Adaptavist-
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 Champions.
August 10, 2022

Welcome to the Atlassian Community!

Fields are defined as "read only" by virtue of being a read-only field (there is a type of field for that) or by not being on screens where people can edit them.

A listener has nothing to do with the configuration of a field, it's there to take action when events happen. 

You could write a listener that removes fields from screens so it becomes read-only, but I don't think it will be of much use to you.  Once a field has been removed from a screen to make it read-only, then you won't be able to fill it in on create or transition, nor edit it.  On any issue, new or old.  It's a one-off, the first time it runs, it will rid all issues of field access.

In short, I think you'll need to take a different approach.  Define a truly read-only field, which a listener calculates when your group fills in the existing field and use that in your structure instead, or create a scripted field which can work out what should be there and can look at who is editing the existing field and ignore it if it's the wrong people.