Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scriptrunner: Add a Condition to a Web Section Limiting Issue Type

Having some trouble with Script Fragments in Jira Software 8.1.0. and Adaptavist ScriptRunner


One of my projects contains a unique Issue Type called AWS Migrations. We create a parent issue and six sub-tasks underneath it for each software environment (QA, Pre-Prod, Practice, Production, and Demo).

I want to replace the Clone button with multiple scripts to Clone to P_PRE, Clone to P_PS, Clone to P_PRD, and Clone to P_DEM. This will allow me to create a custom clone script that also edits certain values in the master ticket that are important for each environment.


My first script fragment should hide the Clone option from the More dropdown, but only if the Issue Type is AWS Migrations. I added the following condition and it works fine.

! ( == "AWS Migration")

My next script fragment is to add a new option Clone to P_PRE to the More dropdown. Since this should only be available if Issue Type is AWS Migrations, I figured this should work. == "AWS Migration"

Instead, I get the following checking error:

[Static type checking] - The variable [issue] is undeclared.
@ line 1, column 1.


Why is this happening? What is the correct syntax for the condition?

3 answers

1 accepted

0 votes
Answer accepted

try using instead

No love with that one either. == "AWS Migration"

[Static type checking] - The variable [jiraHelper] is undeclared.

did you actually try to save it and see if it works? because i tried logging it and it was fine. dont let simple type checking errors stop you.

i feel like even your original condition might be working. 

That's odd, I replied about an hour ago and it's not here.

At any rate, I enabled both fragments and I successfully hid the original Clone option, but the new "Clone to P_PRE" option is missing.


I think you are mistaking web section and web item

web section is basically what it is - a section (like how you see "create sub-task" button in your example is separated from top and bottom elements - that's because it'l located into it's personal section)

So I'd refer to examples here:

Like Michael Thompson likes this

You're absolutely right, that is what I was doing wrong. I changed the fragment to a Web item and the "Clone to P_PRE" option appears in the drop down. Thanks Ilya!

I can't accept your reply as the answer, so I will accept the message thread. :)

0 votes

The web section is just a placeholder for the web items to go into.

So set your section to always be visible. It should only display when you have a visible web items in it.

And the web item has the issue as an available binding.

0 votes

I guess different types of fragments have different types of Binding Variables.

What kind of fragment are you using in the second case? Also, there's a (?) question mark button in the bottom right corner which shows which variables you can use without declaring to help you.

Hi Ilya,

In the second case, I am using "Create a custom web section".

I did click on the question mark, but the resulting information wasn't particularly useful (see screenshot). Nothing clickable, just a vague commentary.


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events