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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

260 views 0 6
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