Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

NullPointerException error on Groovy Script

Sandhya Muthukumar April 1, 2024

I am a Jira Admin and I am trying to add users to project roles using Groovy Script

But it is throwing an error Null Pointer Exception on addActorsToProjectRole, eventhough all the inputs have values except for error collection

 

projectRoleService.addActorsToProjectRole(currentUser,usersToAdd as Collection,projectRoles,projectKey,userRoleActor,errorCollection)
ERROR:
Script console script failed: java.lang.NullPointerException at com.atlassian.jira.bc.projectroles.DefaultProjectRoleService.createRoleActors(DefaultProjectRoleService.java:891) at com.atlassian.jira.bc.projectroles.DefaultProjectRoleService.updateActorsToProjectRole(DefaultProjectRoleService.java:715) at com.atlassian.jira.bc.projectroles.DefaultProjectRoleService.addActorsToProjectRole(DefaultProjectRoleService.java:1073) at Script96.run(Script96.groovy:56)

1 answer

1 accepted

0 votes
Answer accepted
PD Sheehan
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.
April 19, 2024

Did you initialize the error collection?

Like this:

def errorCollection = ErrorCollections.empty()

If you've already done that, try adding some debug output and share the output?

log.info "currentUser=$currentUser (${currentUser.getClass()})"
log.info "usersToAdd=$usersToAdd (${usersToAdd.getClass()})"
log.info "projectRoles=$projectRoles (${projectRoles.getClass()})"
log.info "projectKey=$projectKey (${projectKey.getClass()})"
log.info "userRoleActor=$userRoleActor (${userRoleActor.getClass()})"
Sandhya Muthukumar July 10, 2024

Thank you. Let me try if this works!

Suggest an answer

Log in or Sign up to answer
TAGS
loom essentials certification, loom training, get certified in loom, atlassian certification, loom async video, video messaging skills, atlassian learning, loom for teams, online certification, loom badge, loom for business, atlassian education

Get Certified in Loom! 🧑‍🎓

Time to up your Loom game! The new Loom Essentials Certification is here! Show off your skills, learn pro tips, and get officially recognized. Perfect for taking your video messaging to the next level.

Learn more
AUG Leaders

Atlassian Community Events