Jira Scriptrunner Behaviours: 'and' conditions

Greg Hoggarth December 5, 2017

I am trying to use behaviours to restrict when a particular field is editable.

 

The field is called Feature Outline and it is a multi-line text field. We want to restrict it two ways:

* Only people in an admin user group are allowed to edit this field

* Those people are only allowed to edit it when the issue is in a Proposed state

 

This is effectively a requirements gathering ticket. The admin people are allowed to propose new projects and fill out the Feature Outline for what they want, and when they are happy they can move it to Confirmed state. When in Confirmed, engineering can respond to the requirements, and if there is a change needed, it is pushed back to Proposed.

The admins are only allowed to edit the Outline when it is in Proposed state. When it is in Confirmed or Finalised states, no-one can edit the Outline.

I figured Behaviours was the easiest way to get this working, with the Readonly attribute.

I have tried adding the following conditions but they seem to be operating in an "or" manner and not an "and" manner:
Field - Feature Outline, ReadOnly, Except:

* For workflow step Proposed

* Current user in group Admins

 

If I only have the first one, then I can see that it is editable only when it's in the Proposed status, but unfortunately there's no restriction on the users who can edit it. When I include the admin clause, it lets me edit the field regardless of what status it has, which is wrong.

1 answer

1 accepted

1 vote
Answer accepted
Greg Hoggarth December 5, 2017

Actually I found out how to do this - you have to add another behaviour for the same mapping for that field, and put 1 of the conditions in that one. Then when the behaviours are being tested, they work together like an 'and' clause.

Pity that there's no way to just do this in a single behaviour though.

Suggest an answer

Log in or Sign up to answer