scriptrunner.jira.workflow.ScriptWorkflowFunction failed

Good morning,

I'm trying to execute a groovy script in order to transition linked issue status when another issue change status.

My code is:

def com.atlassian.crowd.embedded.api.User user = ComponentManager.instance.jiraAuthenticationContext.getLoggedInUser()
    IssueService issueService = ComponentManager.getInstance().getIssueService();
    IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();
    TransitionValidationResult transitionValidationResult = issueService.validateTransition(user, newIssue.getId(), 11, issueInputParameters);
    if (transitionValidationResult.isValid())
        log.debug "OK"
        def transitionResult = issueService.transition(user, transitionValidationResult);
        if (!transitionResult.isValid())
            log.debug "KO"
        //    // Do something
            log.debug "KO"
        log.debug "KO"

The script works properly, the linked issue's status is correctly changed but in the log I see this error:

2014-11-07 09:28:40,295 ... ERROR ... /secure/CommentAssignIssue.jspa [scriptrunner.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: XXX-16, actionId: 11, file: customScripts\XXX.groovy
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(
    at com.atlassian.jira.issue.IssueManager$ Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runScript(ScriptRunnerImpl.groovy:403)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runScript$7.callCurrent(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runFileAsScript(ScriptRunnerImpl.groovy:182)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runFileAsScript$ Source)
    at com.onresolve.scriptrunner.canned.jira.utils.CustomScriptDelegate.doScript(CustomScriptDelegate.groovy:47)
    at com.onresolve.scriptrunner.canned.jira.utils.CustomScriptDelegate$doScript$ Source)
    at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CustomScriptFunction.doScript(CustomScriptFunction.groovy:20)
Caused by: com.atlassian.jira.workflow.WorkflowException
    at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(
    ... 10 more
Caused by: java.lang.NullPointerException
    at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(

How can I solve and remove this error?

Thank you in advance

1 answer

1 accepted

1 vote

It must be a different script - it's caused by a problem createIssue on line 114 of your script, yet I don't see any call to that in the script you posted.

The reindex should not be required.

FWIW, createIssue seems to be failing because the project is broken or missing...

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

352 views 0 6
Read article

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