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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Sunday in Agility

You asked for it, so we delivered: images on issues have arrived

A picture tells a thousand words. And agility boards have just released their latest feature: cover images on issues – so now your board can tell a story at first glance. Upload attachmen...

218 views 2 11
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