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

444 views 3 17
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