Help on groovy script debugging

Aditya Verma
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.
August 11, 2017

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

Atlassian Community Events