Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Receive Error "Cannot Get Property Issue Type on null object on script runner behavior scripts

Nannette Mori
Contributor
November 22, 2022

Script Runner Version: 6.56.0

Jira Data Center 8.22.6

We have created several Behavior Script using Script Runner.  The Behavior Scripts work but in the atlassian.log I am seeing the error below on the "Create Issue" event.

Script failed on issue (Create Issue) Cannot get Property Issue type  on null object

How do we fix this?

 

 

 

1 answer

0 votes
Florian Bonniec
Community Champion
November 22, 2022

Hi @Nannette Mori 

 

What is the script causing this issue ? You seems to use the function getIssueTypeObject or getIssueTypeId on an issue object that is not defined.

 

You should use the code below instead.

getIssueContext().issueType.name

At issue creation the issue you are creating do not exist yet, context does. 

Regards

Nannette Mori
Contributor
November 30, 2022

I was using the following:

 

def issue = getUnderlying issue()

def issueType = issue.IssueType

 

if(issueType.name == "DR)

Florian Bonniec
Community Champion
November 30, 2022

Yes but issue do not exist yet when you are on the create screen.

Nannette Mori
Contributor
December 1, 2022

so do I change def issueType = getIssueContext().issueType.name

Florian Bonniec
Community Champion
December 1, 2022

yes

Suggest an answer

Log in or Sign up to answer