Wrote a plugin to auto create several tasks linked to an Epic. Now trying to assign these created tasks to the Epic (I also link them but assigning them to the Epic makes it easier to use). I can see the "Epic Link" and "Epic Name" custom field values and noticed that Greenhopper is using IssueImp for the Epic Link custom field: XX-1234 (toString) class com.atlassian.jira.issue.IssueImpl (getCLass.toString)
I am using IssueInputParameters to create my tasks. Just using addCustomFieldValue on "Epic Link" to add the Epic Issue (Issue class) to indicate that these created tasks are in the Epic does not work. Using a MutableIssue of the Issue as data to store does not work either: error: no suitable method found for addCustomFieldValue(String, MutableIssue / Issue / Object
What is the right way to store a complex object like IssueImp or Issue as a custom field? I personally would store a key as link in a custom field but because this needs to work with Greenhopper I need to store it in the same format so I can't change that approach. Thanks!
Examples were asked:
IssueInputParameters issueIP = this.issueService.newIssueInputParameters();
issueIP.addCustomFieldValue("Epic Link", (Object) issueManager.getIssueObject("XX-1234"));
IssueService.CreateValidationResult issueinput = issueService.validateCreate(user, issueIP);
error: no suitable method found for addCustomFieldValue(String,Object)
issueIP.addCustomFieldValue("Epic Link", Issue);
will result in
error: no suitable method found for addCustomFieldValue(String,Issue)
Similar for MutableIssue
Thanks Nic! I was looking for storing more Objects than just the example for Epic above but I would definitely prefer to use that API for the Epic linking. I am surprised you mentioned that it is not a IssueImp as thats what I got back from a getClass.toString().
Any advice you can give in regards to storing any other complex objects or is the addCustomField pretty much only accepting String input?
Most custom fields need objects that represent their content. For numbers, that's easy - int, long and doubles can all go in. Text fields expect strings, dates expect Timestamps, and so-on. The Jira specific types are ones like users and "options" (for most fields that are selects or radio or checkmarks). Field with multiple values need arrays of those objects. So a select list expects one option, and a multi-select expects an array of options
Although I have a nagging doubt that some of them changed slightly recently - select lists may be expecting singleton objects containing one option. I need to dig that code out...
Thanks Nic, that explains a lot and will help with my other items for the auto created tasks!
Concerning greenhopper, I can add jira-greenhopper-plugin to my pom.xml however com.atlassian.greenhopper.manager is not in that jar and cannot be imported 5.6.2 from https://maven.atlassian.com/repository/public/greenhopper/jira-greenhopper-plugin/
I have been trying to complete this call but I have reached a dead end. I am unable to inject the EpicLinkManager or the EpicLinkManagerImpl class. At this point I simply create a EpicLinkManagerImpl and then call a getEpic of that new class. That crashes though even if the issue has an epic link:
[INFO] [talledLocalContainer] 2017-11-29 18:59:51,763 http-nio-2990-exec-3 ERROR [o.a.c.c.C.[.[localhost].[/jira].[action]] Servlet.service() for servlet [action] in context with path [/jira] threw exception [java.lang.NullPointerException] with root cause
[INFO] [talledLocalContainer] java.lang.NullPointerException
[INFO] [talledLocalContainer] at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.getEpicLinkType(EpicLinkManagerImpl.java:484)
[INFO] [talledLocalContainer] at com.atlassian.greenhopper.manager.issuelink.EpicLinkManagerImpl.getEpic(EpicLinkManagerImpl.java:79)
What am I doing wrong?
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot