scriptrunner.jira.workflow.ScriptWorkflowFunction failed

Arianna Fabbri November 6, 2014

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
Answer accepted
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 7, 2014

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
TAGS
AUG Leaders

Atlassian Community Events