ScriptRunner for Jira - Field is not locking

Karrie Dash April 28, 2017

I am trying to lock a field so a specific group cannot edit the value.

Below is the setting I have configured but the Group is still able to edit the Issue Type field. What should I change so this field is locked?

unnamed.png

1 answer

0 votes
Aidan Derossett _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.
April 28, 2017

It seems to work when testing on my end. Can you also send a screenshot of your current Mappings and ensure that the projects and issue-types that you are wanting this to apply to are mapped to the behaviour?

Karrie Dash April 28, 2017

 Here are a few screenshots of my settings. The plug in works for some fields (ie: Priority & Issue Status) but not all (ie: Issue Type & Labels).

For the Mapping, All Projects is selected.

A.PNGB.PNGC.PNGD.PNG

Jonny Carter
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.
May 2, 2017

A few thoughts:

Your first condition seems to read "Issue type should be read-only when the current user is in the Hopkins CTE group." Same thing for priority in the later screenshot. What group is able to edit the field that you would expect to be unable to? Is it Hopkins CTE, or are your expecting something else?

On some screens, it makes sense that it wouldn't work for Issue Type, since Behaviours require a project / issue type combination in their definition. Now, you should be able to make issue type read only if you're on the regular edit screen, but the first screen where you choose product and issue type won't fire behaviours, I don't think. On the subsequent screen (the full create/edit view), you should be able to make the issue type read only, though.

In your screenshot of the behaviour's mapping, it looks like you don't have a project selected. You need to select at least one, or select "All" if this is for all projects.

Also, be aware of the known limitations of behaviours. Two may be germane in your case:

  1. If network latency is a factor, you may see some delay before a behaviour is applied.
  2. Multiple behaviours are not allowed on the same field. If you have more than one behaviour in overlapping contexts that affects the same field, only one will fire. Since your behaviour seems to be mapped to all projects and all issue types, that may be your problem.

 

Jonny Carter
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.
May 2, 2017

Also, there are some known limits for the label field:

https://productsupport.adaptavist.com/browse/SRJIRA-1080

If you're trying to set a default value, this won't work in the current release (5.0.1).

Karrie Dash May 4, 2017

What group is able to edit the field that you would expect to be unable to? Is it Hopkins CTE, or are your expecting something else?
Hopkins CTE is able to edit the field, but they should not be allowed to do so.

On some screens, it makes sense that it wouldn't work for Issue Type, since Behaviours require a project / issue type combination in their definition.
Can it be made read-only when on the View Issue screen?

In your screenshot of the behaviour's mapping, it looks like you don't have a project selected. You need to select at least one, or select "All" if this is for all projects.
Sorry, when I did my screenshot of the mapping nothing was showing as selected, but a project was selected.

Suggest an answer

Log in or Sign up to answer