script runner cannot create a task for specific user

Script runner 3.0.9

JIRA 6.3.11

One user with the same right than me cannot create a task during a transition...

here the log :

2015-03-18 16:13:54,032 http-bio-8090-exec-21 ERROR fbernier 973x208702x1 108dwji, /secure/CommentAssignIssue.jspa [scriptrunner.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: ST-40171, actionId: 891, file: <inline script>
at com.atlassian.jira.issue.IssueImpl.getCustomFieldValue(
at com.atlassian.jira.issue.Issue$getCustomFieldValue$ Source)
at com.atlassian.jira.issue.Issue$getCustomFieldValue$ Source)



Please, someone can help me azap ?


the script :

import com.atlassian.jira.user.UserUtils
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.util.ImportUtils
import com.atlassian.crowd.embedded.api.User
import com.opensymphony.workflow.WorkflowContext
import org.apache.log4j.Category
import com.atlassian.jira.issue.fields.CustomField
log = Category.getInstance("com.onresolve.jira.groovy.CreateDependentIssue")
// Configurable section
def projectName = "Technician" // Name of project you want to create the issue in
def CustomTechFieldName = "customfield_11812"
//def CustomTerminalName = "customfield_11811"
def customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
CustomField customFieldTech = customFieldManager.getCustomFieldObject(CustomTechFieldName)
//CustomField customFieldTerminal = customFieldManager.getCustomFieldObject(CustomTerminalName)
def customFieldTechVal = issue.getCustomFieldValue(customFieldTech).name
//def customFieldTerminalVal = issue.getCustomFieldValue(customFieldTerminal)

// for other customisations change the code below
issueMgr = ComponentManager.getInstance().getIssueManager()
projectMgr = ComponentManager.getInstance().getProjectManager()
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();
User currentUserObj = UserUtils.getUser(currentUser);
def wasIndexing = ImportUtils.indexIssues
ImportUtils.indexIssues = true
issueFactory = ComponentManager.getInstance().getIssueFactory()
newissue = issueFactory.getIssue()
newissue.setSummary (issue.summary) 
//+" - "+customFieldTerminalVal
newissue.setProject (projectMgr.getProjectByName(projectName))
newissue.setIssueType (issue.getIssueType())
newissue.description = issue.description
newissue.assignee = UserUtils.getUser(customFieldTechVal);
newissue.reporter = issue.getAssignee()
def cf = customFieldManager.getCustomFieldObjects(issue).find { == 'Location'}
newissue.setCustomFieldValue(cf, issue.getCustomFieldValue(cf))
params = ["issue":newissue]
subTask = issueMgr.createIssue(currentUserObj, params)
println subTask.get("key")
// get the current list of outwards depends on links to get the sequence number
linkMgr = ComponentManager.getInstance().getIssueLinkManager()
def sequence = 0
for (IssueLink link in linkMgr.getInwardLinks( {
    if ("Blocks" == {
linkMgr = ComponentManager.getInstance().getIssueLinkManager()
// TODO: Should check that 10000 is always the link id for Blocks
linkMgr.createIssueLink (,, 10000, sequence, currentUserObj)
ImportUtils.indexIssues = wasIndexing




1 answer

This widget could not be displayed.

Hi @Olivier Albertini,

It looks like when you are trying to call

def customFieldTechVal = issue.getCustomFieldValue(customFieldTech).name

you are getting a null pointer exception.

That is probably happening because customFieldTech is not present (is null) in the issue from which the other user is trying to call the transition. Therefore an exception is thrown due to the fact that you are trying to retrieve the property "name" from a null object.

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...

510 views 3 18
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