Jira Scriptrunner Behaviours: 'and' conditions

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

0 votes
Accepted answer

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
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,750 views 18 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you