Hello Atlassian users,
I have a custom field that should be 'locked' while in a Closed status. So after the issue has transitioned to Closed, the field should only be viewable, not writeable.
I have tried adding a Behaviour using ScriptRunner, but I can only make the field un-editable during a workflow transition...not during the workflow Closed status itself.
I have looked at adding a listener...but unsure of what the code should look like and if this will do want I envision...or the same thing as the Behaviour. (I do not want to only have the custom field on the view screens either).
End result should render the custom field read only while the issue is in the Closed status. Once the issue is re-opened, it can be writeable again.
Any assistance/thoughts are appreciated. Thanks--Lara
Are you saying you want restrict a field to be read-only when the status is "Closed"?
You can try to put this snippet in a Behaviour's Initialiser:
def status = underlyingIssue.getStatus().getSimpleStatus().getName()
if (status == "Closed") {
getFieldByName("Your Field Name").setReadOnly(true)
}
@Max Lim _Adaptavist_ what about inline edit? I guess, behaviours solution is acceptable only when Field is not placed on Edit screen. Am I right?
I guess we need more information to provide better solution :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tested it, this will work even when you are just viewing the issue and inline edit.
Try it yourself. 👍🏻 Just remember to refresh your issue viewing tab after saving the behaviour.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, I had no idea that behaviours works on view screen. I always set it up on transition screens. Thank you for clarification :).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you have ScriptRunner then a Behaviour is the way. If not, then jira.issue.editable property in https://confluence.atlassian.com/adminjiraserver/workflow-properties-938847526.html for Server/Data Center
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Matt Doar Behaviour seems to only allow it during transition...I want to be able to edit on transition to Closed...just not during the issue being in closed status.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Lara Arthur what type of custom field is it? Is it built-in field? Do you need to edit other fields in Closed status?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Martin Bayer _MoroSystems_ s_r_o__ . Custom created field - single select list. Yes, all other fields can be editable.
We capture and report on a Bug Category field in our Bug issue type. Right now if it is in Closed status, some one can actually change it to 'None', but we want to freeze the field on Closed in order to always query on Closed and have a valid selection in the field... if that makes sense.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, if it is custom created field, it is quite easy to adjust the source code so it is not editable when issue's status is "X". But I guess behaviours is enough for you :).
If you would like to check the possibility which does not include 3rd party apps, just let me know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.