You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Jira 8.26.1
Script Runner V 6.56
At Create getting error "Cannot Invoke method getStatus on a null object" at Create in Script Runner Behavior Script
import com.atlassian.jira.issue.*
import com.atlassion.jira.component.*
def issue = getUnderlyingIssue()
def IssueType= getIssueContext().issueType.name
def issuseStatus = issue.getStatus().getName()
def fixVersions = issue.fixVersions
I am not a scripter so any assistance on how to resolve the above error will be appreciated
I'm not currently in front of a console, but if not mistaken you are trying to get the status of an issue, before it's creation. No wonder it returns null. It doesn't yet have a status :)
What are you trying to do?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
def issue = getUnderlyingIssue
def issueStatus = issue.getStatus().getName
So I think it is trying to get the status of the current issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You guessed it. Remove the following line
def issueStatus = issue.getStatus().getName
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can't remove that line I need that getstatus line to get the status of the current issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But it doesn't have a status yet. How is it possible to return something else but null?
Let's go again and I hope that you will figure it out:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I understand that at create issue the issue type and status are unknown. But the Behavior fires at the Create issue event. You really don't need to be condescending. You told me to remove the
def issueStatus = issue.getStatus().getName
I was just telling you that I need that line.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry if you misunderstood my reply. There wasn't any bad intention to it. The behaviour doesn't fire at the issue created event. The issue created event is fired as a post function after the transition takes place. You want to keep that line and that's fine. But to answer your initial question, you can't solve this problem, because that line, where you've placed it, will always return null.
If you describe your business requirement and what you want to achieve, I might be able to help you out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We are using a behavior to validate at certain states that the fix version is a valid delivery version. We want to use a behavior because when you use a validator on a transition the users can update the Fix version back to an invalid delivery in-between transitions in the edit screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.