Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cannot invoke method getName() on null object in Validator

I am trying to create issue B from issue A using button menu "Create linked issue" in Validators of Create transition:


import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.issue.IssueManager
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.event.type.EventDispatchOption;
import com.opensymphony.workflow.loader.ActionDescriptor
import com.opensymphony.workflow.loader.StepDescriptor
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.issue.IssueInputParametersImpl
import com.atlassian.jira.workflow.TransitionOptions

def log = Logger.getLogger("com.acme.CreateSubtask")
log.setLevel(Level.DEBUG)'1. Test')
def isEpicIssueClosed = false;'2. isEpicIssueClosed BEFORE: ' + isEpicIssueClosed)'3. The creacted issue is: ' + issue + '. Its status is '+ issue.getStatus().name)

if(issue.getStatus().name == 'Closed') {
isEpicIssueClosed = true;
}'4. isEpicIssueClosed AFTER: ' + isEpicIssueClosed)
isEpicIssueClosed == false

But I see the following error: 

2018-08-02 18:11:06,513 INFO [acme.CreateSubtask]: 1. Test
2018-08-02 18:11:06,515 INFO [acme.CreateSubtask]: 2. isEpicIssueClosed BEFORE: false
2018-08-02 18:11:06,515 INFO [acme.CreateSubtask]: 3. The creacted issue is: Test of improvement
2018-08-02 18:11:06,517 ERROR [utils.ConditionUtils]: *************************************************************************************
2018-08-02 18:11:06,517 ERROR [utils.ConditionUtils]: Condition failed on issue: null, built-in script:com.onresolve.scriptrunner.canned.jira.workflow.validators.SimpleScriptedValidator
java.lang.NullPointerException: Cannot invoke method getName() on null object


Guys, what am I doing wrong?

This code works perfectly in other post-functions:

if(issue.getStatus().name == 'Closed') { 


1 answer

1 accepted

1 vote
Answer accepted

Hello @zaharovvv_suek_ru
This is happens because issue does not have status yet

Status sets in postfunction section and validators executes earlier.

So you cannot check status before issue will be created

Hi @Mark Markov , 

I have written a script fragment and I am checking for the issue type in condition section. But, It throws an error saying Cannot invoke method getName() on null object. 

2019-05-10 04:44:34,465 http-nio-8080-exec-76 ERROR anonymous 284x1351975x68 lhqo48 /login.jsp [c.o.scriptrunner.fragments.JiraScriptCondition] Script condition failed: java.lang.NullPointerException: Cannot invoke method getName() on null object

 Note: This is happening whenever the user login and logout. 

Can you please take a look. This is how i am checking in condition section. == 'FEATURE'

Suggest an answer

Log in or Sign up to answer
Community showcase

All you wanted to know about customer support KPIs

When working in customer support, it’s crucial to calculate, analyze and monitor specific numbers, called KPIs (Key Performance Indicators). They go hand-in-hand with customer satisfaction, problem d...

133 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you