Groovy Script Error : when associating issue with epic automatically

AK February 17, 2014

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

1 vote
Answer accepted
AK February 18, 2014

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

JamieA
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.
February 18, 2014

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

AK February 23, 2014

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

1 vote
JamieA
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.
February 18, 2014

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.

0 votes
AK February 18, 2014

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

Atlassian Community Events