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

This widget could not be displayed.

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
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

533 views 3 19
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