Forums

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

Make the issue non-editable based on field value

nallu November 21, 2018

Hi, 

I want to set `jira.issue.editable` property to false if the field value is x. I want to do it through behaviour or script listener. 

Can anyone please help me to set this property via groovy script

1 answer

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 Leaders.
November 21, 2018

This won't work.

The jira.issue.editable property is a workflow property.  It kicks in on a workflow status.  This means that if you did write a script that would set it to false when a custom field was X, all issues using that workflow would become uneditable while in the status you set it on as soon as you did it for the first issue.

There's no way to block edit on an issue just because a field changes.

nallu November 27, 2018

Hi @Nic Brough -Adaptavist-, Thanks for the answer. 

Is there any other way to override the workflow property then? 

What I am thinking, Lets set the 'jira.issue.editable' to false when the issue is moved to certain status. So, issue will not be editable when it is in X status. 

But, I want to monitor the field through script listener or behavior. So, if field X doesn't have value set, I would like to override the workflow property. Meaning, It should make the issue to editable or atleast it should make the particular field to editable.

Please share your thoughts.

Thanks for your help!

nallu November 28, 2018

Hi @Nic Brough -Adaptavist-,

Here is my requirement, 

- Lock the issue (make it non-editable) when it is moved to certain status. : So, I will add a 'jira.issue.editable' property to false to a status

- Behaviour script/ script runner should check the value of an field at anytime. If the field is not having value as production, then it should make the issue to editable. 

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 Leaders.
November 28, 2018

Again, the property belongs to the status, not the issue.  There isn't anything to override based on fields, because it's a status property.

nallu November 28, 2018

Thanks @Nic Brough -Adaptavist-. So, no solution / workaround for my requirement??

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 Leaders.
November 28, 2018

You could validate instead - on a transition, use a validator that checks what you need and refuses to let the issue move on unless it is correct.

nallu November 28, 2018

Hi @Nic Brough -Adaptavist-

In our case, we should not restrict the user to move an issue to certain status based on the value of the field. 

thats the problem...

We should let the user to move the certain status irrespective of field value.

Depends on the field value, we should make the issue non-editable. 

anything can be done to achieve this @Nic Brough -Adaptavist-??

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 Leaders.
November 28, 2018

No.  As I said.  Your best option is a validator.

You could also muck around with javascript, or better, Behaviours from Scriptrunner, but these can easily be bypassed if people feel like it and will be completely ignored by certain add-ons and automations.

Suggest an answer

Log in or Sign up to answer