Forums

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

How to hide/show a custom field depending of the security level value (using ScriptRunner behaviors)

Maxim Grouchevoi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 1, 2018

Hi guys,

I have to hide/show a custom field (multiple group picker) in dependance of the chosen issue-level security during the issue creation. All I know - I have to create a ScriptRunner behaviour. But how can I get the value of the issue-level security and code the condition? 

Any help is appreciated. Thx!

1 answer

0 votes
Alexey Matveev
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.
June 1, 2018

if (ComponentAccessor.getIssueSecurityLevelManager().getIssueSecurityName(underlyingIssue.getSecurityLevelId()) == "yoursecurityname") {

// your code

}

Maxim Grouchevoi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 4, 2018

Thank you, Alexey! 
But where should I put this code? And how can I hide/show a custom field? Should I declare or initialize something in this behavior in front?

Sorry for this noob-questions, I really appreciate your help.

Alexey Matveev
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.
June 4, 2018

You should

1. Create a behaviour in the coq wheel -> add-ons -> behaviours.

2. Map the behaviour to the required project and issue types

3. Add the script to the initialize functions:

import com.atlassian.jira.component.ComponentAccessor

if (ComponentAccessor.getIssueSecurityLevelManager().getIssueSecurityName(underlyingIssue.getSecurityLevelId()) == "yoursecurityname") {

// your code

}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events