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

workflow validator - java.lang.NullPointerException error Edited


I would like to make a validator with simple scripted validator.

Parent Feature is the key of linked issue.

Internal Feature is a custom field, type Checkbox , It has one option- 'Yes'. 

I have an error- java.lang.NullPointerException,  and the code all the time return false.. What is the problem with my code ?




The code is:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager

//get the parent feature issue

Issue featureT = ComponentAccessor.issueManager.getIssueObject('Parent Feature');

//custom field internal feature
def internal = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Internal Feature");
def selectedValues = internal.getValue(featureT);
def bool=true;
if(featureIssue.fixVersions != issue.fixVersions)
return bool;

2 answers

Hi Daniel,

Is it the whole script?

not sure what the value 'Parent Feature' in the following line represent, the getIssueObject function should get an issue key (e.g. TEST-54)

Issue featureT = ComponentAccessor.issueManager.getIssueObject('Parent Feature');


Hi Dar,

Is, it is a whole script..

'Parent Feature' is the key of the linked issue.

Hey @Dan27

As I can see from your script, you have a few problems-

1) You store some string when you get the Feature issue object- if you meat that the string "Parent Feature" is a field that contains the Feature key- you can see it in the script I added (if you don't need it like that and you have some absolute issue key, you can add it hardcoded in the script)

2) You are not consistent with the variables (where does "featureIssue" come from?)

3) When you take value from a custom field (selectedValues) first you need to take the issue object, value, and custom field, like this- issue.getCustomFieldValue(cf)

Try this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue

def customFieldManager = ComponentAccessor.getCustomFieldManager();
//get the parent feature issue
String parentFeatureKey = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Parent Feature"));
Issue featureIssue = ComponentAccessor.issueManager.getIssueObject(parentFeatureKey);
//custom field internal feature
def internal = customFieldManager.getCustomFieldObjectByName("Internal Feature");
def selectedValues = featureIssue.getCustomFieldValue(internal);

def bool=true;
if(featureIssue.fixVersions != issue.fixVersions){
return bool   

Hope this information will help you in the future. 

Let me know if it's work for you



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

179 views 2 1
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