Create Issue error : null

When I trying to create a subtask issue automatically on creating issue.

I am getting this error.

The Issue is created but subtask issue is not created.

The code is as follow:

protected void createSubTask(Map<String, Object> transientVariables, Map<String, String> args)

{

Issue originalIssue = (Issue)transientVariables.get("issue");

Issue parentIssue = originalIssue;

MutableIssue issueObject =this.issueFactory.getIssue();

issueObject.setIssueTypeObject(this.constantsManager.getIssueTypeObject((String)args.get("field.subIssueTypeId")));

issueObject.setPriorityId(this.constantsManager.getPriorityObject((String)args.get("field.subIssuePriorityId")).getId());

Map params =new HashMap();

params.put("issue", issueObject);

try

{

User user = ComponentManager.getInstance().getJiraAuthenticationContext().getLoggedInUser();

Issue subTask =this.issueManager.createIssueObject(user, params);

this.subTaskManager.createSubTaskIssueLink(parentIssue, subTask, user);

ImportUtils.setIndexIssues(true);

ComponentManager.getInstance().getIndexManager().reIndex(subTask);

}

catch(Exception e)

{

log.error("Unexpected exception", e);

}

ImportUtils.setIndexIssues(false);

}

2 answers

1 accepted

This widget could not be displayed.

Thanks for your time Nic and AUser

I am cleared with the error.

The error was due to following statement

issueObject.setPriorityId(this.constantsManager.getPriorityObject((String)args.get("field.subIssuePriorityId")).getId());

It is returning null and abnormally terminating the execution.

This widget could not be displayed.

You don't say what error you are getting.

NullPointerException

Yes, that's about as useful an answer as me building a tree for my imaginary penguin.

Where does the error occur and what debugging have you done and what were the results?

I havent done anything, bcause I am not the the user who posted that question!

There is a missing "?" behind my comment, because i wantet to know if this is the exception or one of his data is null.

That'y your point of view! I also could have asked him in which line the error occures. And this doesn't gets us anywhere, too.

Bharadwaj - excellent, thank you for

AUser - it's great to want to contribute, but being completely unclear really doesn't help. Even with a ? on the end, you're simply prompting the response of "yes", which gets us nowhere.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

143 views 2 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you