Groovy Script Error : when associating issue with epic automatically

Hi,

I am working on a groovy script (which runs as post function) that creates an issue soon after an Epic is created and also associates the created issues with the Epic. So if the scripts runs successfully I should see the created issue under "Issues in Epic" field.

I am able to create the issue as soon as epic is created, but the association fails(i.e., unable to see created issue under "Issues in Epic field").

I get below error in logs:

The script failed : javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.associateIssuesWithEpic() is applicable for argument types: (com.atlassian.jira.user.BridgedDirectoryUser, com.atlassian.fugue.Option$Some, java.util.HashSet) values: [USER:10200, some(SCRUM-102), [SCRUM-103]]
Possible solutions: associateIssuesWithEpic(com.atlassian.crowd.embedded.api.User, com.atlassian.fugue.Option, java.util.Set)

I am using instance of "epicLinkManagerImpl" and calling associateIssuesWithEpic() as in below code

Issue archIssue =issueManager.createIssueObject(user,issueObject)
				User user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
				def epic = (Option)Option.option(issue)
				def issueSet = new HashSet<Issue>();
				issueSet.add(issueObject);				
				epicLinkManagerImpl.associateIssuesWithEpic(user, epic, issueSet);

I wrote above based on the information obtained here

After going through couple of forums, I felt that it might have something to do with the plugins I am using, but don't any proofs to support the same.

Looking for some help here :)

Thanks,

Aravind

3 answers

1 accepted

Hi Jamie,

Got the script working after changing the method to "createLink" from "associateIssuesWithEpic".

Our current version of gh-plugin is 6.3.6, API doc of which shows "associateIssuesWithEpic()".

But unknowingly on trying createLink() method inplace of above made the script work!

On refering to the documentation found that this method was supported in API version 6.0.7

Not sure how it worked.

Thanks

Oh cool... well done. Sounds like that will be useful others too.

yeah, it worked for me, hope it works/helps others with similar problem too...

1 vote

Don't really understand why that doesn't work... if you look at what you are passing and what it expects it looks correct.

A BridgedDirectoryUser "is a" com.atlassian.crowd.embedded.api.User, so that's not a problem.

"Some" is an "Option", so same there, and clearly a HashSet is a Set.

Can you post a minimal but complete script that demonstrates the issues to gist.github.com, if you do that I will try to reproduce and debug.

Thanks Jamie for the help. Here is the link to the gist where I have placed the script:
https://gist.github.com/ark09/c62a20c4cdae3f98df85

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 6 hours ago 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...

28 views 0 2
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