Help on groovy script debugging

I am getting below error for a groovy script for this particular user, user updated name is heather.Webb but script is picking heather.robertson. i have check this user profile in Jira database and Active directory, everywhere its heather.webb :

##############################################

currentUser=heather.robertson

Script function failed on issue: MOID-127029, actionId: 701, file: /opt/jira/data/data/scripts/MOID/customer_update.groovy

java.lang.NullPointerException: Cannot get property 'displayName' on null object
at com.onresolve.jira.groovy.canned.workflow.postfunctions.customer_update.run(customer_update.groovy:116)

#################################################

 

Corresponding groovy script for this error is :

####################################################

String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();
currentUserObj = ComponentAccessor.getUserManager().getUserByName(currentUser)
log.debug("currentUser=$currentUser")

issue.setCustomFieldValue(newClientCommentCF, null)


newComment = "*" + currentUserObj.displayName /*" - " + pickedClient*/ + " - " + currentDateFormatted + "*\n\r" + newClientComment +"\n\r"
if (currentCommentLog){
issue.setCustomFieldValue (commentsLogCF, currentCommentLog+"----\n\r"+newComment)
}
else
issue.setCustomFieldValue (commentsLogCF, newComment)

}

 

###############################################

 

Somehow its throwing cannot get property displaName for this user.

Any idea how can we resolve this..?

 

I cannot understand from where this ((WorkflowContext) transientVars.get("context")).getCaller(); is picking up the user details.

 

 

Any help is appreciated. Thanks in Advance!!

 

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 31, 2018 in Marketplace Apps

Marketplace Spotlight: Zephyr

Hello Atlassian Community! Each month, we run a series of Spotlights to highlight Marketplace vendors and apps that our team thinks this Community would find valuable. In last month's Spotlig...

330 views 0 1
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