I've been working my way through the custom report plugin tutorial linked here: https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Creating+a+JIRA+Report I'm working in JIRA 5, which hasn't given me too many problems. What I have run into is an issue near the end. The plugin is installed and I have the option to create my report, but it cannot find a value for the Project select list. I looked through my files and it uses:
<property>
<key>projectid</key>
<name>report.issuecreation.projectid.name</name>
<description>report.issuecreation.projectid.description</description>
<type>select</type>
<values class="com.atlassian.jira.portal.ProjectValuesGenerator" />
</property>
I did a little research and found that com.atlassian.jira.portal.ProjectValuesGenerator no longer seems to exist. How would I go about getting the projectid value in JIRA 5?
Any help is appreciated.
Community moderators have prevented the ability to post new answers.
Found it. For a project id, filterprojectpicker returns a String in this format: 'project-10000'. Apparently the ProjectValuesGenerator class returned either a numerical value or a string containing only the projectid (i.e. '10000').
The way the tutorial plugin worked needed a long value for the projectid, so there was a NumberFormatException when I tried to use filterprojectpicker. I parsed out the first part of the string and the plugin works fine now.
Wonderful ... that fixed it for me as well. Thanks a lot! :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you paste your atlassian-plugin.xml changes somewhere? It's not clear what you mean by "parsed out the first part of the string".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am follwoing same tutorial and facing errors as below post:
can you please tell me how it could be resolved at your end?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use the type as filterprojectpicker without any values class. It will also fetch filter values but you can do some validation if you don't want to support it.
The other option ofcourse is to write your own value generator class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What happens when you use the type? Are you not able to choose projects or filters?
Yes, the validation will be done in validate method in the report class, if you do not want filters to be selected.
I would suggest to go for a custom value picker class if you can code. Why should you give the option to select if it is not supported?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jobin
I've tried using the filterprojectpicker type like you suggest. It did not seem to make any difference when trying to generate this report. Could any incoming filter values affect it? And how would I go about adding validation if that's the case? Is that done in the plugin's Java file? The one I'm using is a cut & paste copy of http://svn.atlassian.com/svn/public/contrib/tutorials/jira-report-plugin/trunk/src/main/java/com/atlassian/plugins/tutorial/jira/report/CreationReport.java
Thanks for the quick feedback, either way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I use the type and rebuild the plugin using Fastdev, everything builds and seems to run fine. When I go to generate the report to test it, I get 'Project: Could not find any values for field 'Project'.' and can set the other fields, but only have an option to cancel out of generating the report.
If I try and write a custom value picker, where would I store that in my plugin?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes in all cases. I generated 3 reports before I began testing the plugin, with a few issues thrown into each (since the report is supposed to look for the number of issues generated on a given interval).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you have any projects in the test JIRA? If so, do you have permissions to view them? Are you able to browse those projects?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you add a screenshot with the filterprojectpicker type? Also are there any error in logs?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I haven't seen any errors printed. Attached is my atlassian-plugin.xml file and a screenshot of the page when I try to generate a report. (atlassian-plugin.txt) note: it only lets me attach a .txt file for the atlassian-plugin. And the screenshot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I click the "Projects" drop down above it just shows a list of my 'Current Project' and 'Recent Projects'. Where there should be a "Project" drop down among my four fields, there's nothing. Just the plain text "Could not find any values for field 'Project.'"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just to confirm, what happens when you clikc on the "Project" drop down? The definition looks fine to me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm having the same problem. Here's the XML I am using:
<property> <key>projectid</key> <name>report.issuecreation.projectid.name</name> <description>report.issuecreation.projectid.description</description> <type>filterprojectpicker</type> </property>
No joy, I am stuck with "Could not find any values for field 'Project'". I am trying to follow the tutorial but am having very little luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah ha! I was having the same problem as Adam Steele. I think I found a "solution", although it is terrible.
FastDev reloading does not work, at least not for this change. You must shut down your jira instance and start it again. Takes forever, but when it comes back up the error goes away.
As an aside: You'll also need to change your code so it looks for selectedProjectId instead of projectid. For example:
Long projectId = ParameterUtils.getLongParam(params, "selectedProjectId");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.