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

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

Suggest an answer

Log in or Sign up to answer
1 vote
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 04, 2022

"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)
}
TAGS
AUG Leaders

Atlassian Community Events