Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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
4,461,714
Community Members
 
Community Events
176
Community Groups

Get Workflow status in ScriptRunner using Behavior

Hi,

I have 3 tabs that I display and out of the 3 tabs, 2 tabs are disabled by default using the following script in Behavior.

disableTab(1)
disableTab(2) 

Now, I want to enable Tab 1 from the Behavior ScriptRunner only if the workflow status is "Ready".  Here is the below code:

import com.atlassian.jira.component.ComponentAccessor
def issue = ComponentAccessor.getIssueManager().getIssueObject(underlyingIssue.getKey())
if (issue.status.name == "Ready" ) {
switchTab(1)
disableTab(2)
} else {
disableTab(1)
disableTab(2)
}

The above code does not work.

Can anyone assist?

Thanks,

KP

 

1 answer

1 vote

"underlyingIssue" is an issue. So you don't need to convert it.

The problem is that on a create screen, underlyingIssue doesn't exist. But we can protect against that using the nullsafe operator (?)

So this should work:

if (underlyingIssue?.status?.name == "Ready" ) {
switchTab(1)
disableTab(2)
} else {
disableTab(1)
disableTab(2)
}

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events