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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


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

Receiving Error in Behavior Script "Cannot Invoke method getStatus on a null object" at Create

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()

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


1 answer

Hi @Nannette Mori 

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?

Understood so how do I not get the status at create?

def issue = getUnderlyingIssue 

def issueStatus = issue.getStatus().getName 


So I think it is trying to get the status of the current issue

You guessed it. Remove the following line

def issueStatus = issue.getStatus().getName 

I can't remove that line I need that getstatus line to get the status of the current issue. 

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 have a create issue screen -> this is a screen before the issue is created.
  • You populate this issue create screen with fields, but you don't press submit
  • No issue has been created yet, and you are "stuck" on the little circle on your workflow transition. Keep in mind that the create transition hasn't run yet
  • You create a behavior which mess around values during the issue create screen, but before the issue is created
  • You ask from the issue, which is not yet created, to give you its status
  • The issue will return and will tell you "Hey dudette... I've got no status yet. So here's a null for you"

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.  

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.

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

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events