Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,415
Community Members
 
Community Events
184
Community Groups

Clone project not working on issue transition, but works with script console

Edited

I have a script which reads some custom fields to get the required information to clone a project.

Then I have the following code to clone the project (only relevant parts are shown):

// Bot user has admin access
// src, tar, and name is read from custom field as String
def copyProject = new CopyProject();
def user = ComponentAccessor.getUserManager().getUserByName("bot");
def inputs = [
(CopyProject.FIELD_SOURCE_PROJECT) : src,
(CopyProject.FIELD_TARGET_PROJECT) : tar,
(CopyProject.FIELD_TARGET_PROJECT_NAME) : name,
(CopyProject.FIELD_COPY_ISSUES) : true,
(CopyProject.FIELD_COPY_VERSIONS) : true,
(CopyProject.FIELD_COPY_COMPONENTS) : true,
]

ComponentAccessor.getJiraAuthenticationContext().setLoggedInUser(user);
copyProject.doScript(inputs);

When I run this script using the script console, I get no errors and the cloning works perfectly.

However I added my script to a workflow transition and every time the transition occurs my script fails.

Here is the error log that I can see:

java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:877)
at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4958)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4964)
at com.atlassian.jira.issue.watchers.DefaultWatcherManager.isWatching(DefaultWatcherManager.java:134)
at com.atlassian.jira.issue.watchers.DefaultWatcherManager.updateWatch(DefaultWatcherManager.java:174)
at com.atlassian.jira.issue.watchers.DefaultWatcherManager.startWatching(DefaultWatcherManager.java:92)
at com.atlassian.jira.issue.watchers.DefaultWatcherManager.startWatching(DefaultWatcherManager.java:83)
at com.atlassian.jira.issue.watchers.WatcherManager$startWatching$0.call(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue$_copyWatchers_closure7.doCall(AbstractCloneIssue.groovy:413)
at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue.copyWatchers(AbstractCloneIssue.groovy:412)
at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue.execute(AbstractCloneIssue.groovy:249)
at com.onresolve.scriptrunner.canned.jira.utils.CopyIssueWithAttachments.super$4$execute(CopyIssueWithAttachments.groovy)
at com.onresolve.scriptrunner.canned.jira.utils.CopyIssueWithAttachments.execute(CopyIssueWithAttachments.groovy:25)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue.super$5$execute(CloneIssue.groovy)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue.execute(CloneIssue.groovy:135)
at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CloneIssue$execute.call(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.admin.CopyProject$_doCopyProject_closure13.doCall(CopyProject.groovy:601)
at com.onresolve.scriptrunner.canned.jira.admin.CopyProject.doCopyProject(CopyProject.groovy:580)
at com.onresolve.scriptrunner.canned.jira.admin.CopyProject$doCopyProject.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.canned.jira.admin.CopyProject.execute(CopyProject.groovy:357)
at com.onresolve.scriptrunner.canned.jira.admin.CopyProject.execute(CopyProject.groovy)
at com.onresolve.scriptrunner.canned.AbstractCannedScript.doScript(AbstractCannedScript.groovy:81)
at com.onresolve.scriptrunner.canned.CannedScript$doScript$13.call(Unknown Source)
at add_project.run(add_project.groovy:94)

 
Can anyone suggest why I could be getting this error?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events