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

fedribreakly 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

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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.

Suggest an answer

Log in or Sign up to answer