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();
    issueInputParameters.setAssigneeId(issue.getAssigneeId());
    
    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
        }else{
            ComponentAccessor.getIssueIndexManager().reIndex(transitionValidationResult.getIssue())
            log.debug "KO"
        }
    }else{
        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
com.atlassian.jira.exception.CreateException
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:692)
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:615)
    at com.atlassian.jira.issue.IssueManager$createIssue.call(Unknown Source)
    at SD_DuplicateAndLinkIssueToBackendPrj.run(XXX.groovy:114)
    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$6.call(Unknown Source)
    at com.onresolve.scriptrunner.canned.jira.utils.CustomScriptDelegate.doScript(CustomScriptDelegate.groovy:47)
    at com.onresolve.scriptrunner.canned.jira.utils.CustomScriptDelegate$doScript$2.call(Unknown 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(OSWorkflowManager.java:889)
    at com.atlassian.jira.issue.managers.DefaultIssueManager.createIssue(DefaultIssueManager.java:681)
    ... 10 more
Caused by: java.lang.NullPointerException
    at com.atlassian.jira.workflow.OSWorkflowManager.createIssue(OSWorkflowManager.java:825)

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

126 views 0 4
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