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

JIRA Custom Report Tutorial

Adam Steele July 15, 2012

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.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Adam Steele July 22, 2012

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.

onkeldom
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.
October 28, 2012

Wonderful ... that fixed it for me as well. Thanks a lot! :D

David Kirchner February 20, 2013

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".

0 votes
dhaval soni
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.
January 31, 2013

I am follwoing same tutorial and facing errors as below post:

https://answers.atlassian.com/questions/131406/import-com-opensymphony-user-user-com-atlassian-jira-web-bean-i18nbean-not-found-in-eclipse-plugin-project

can you please tell me how it could be resolved at your end?

Thanks

0 votes
Jobin Kuruvilla [Adaptavist]
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.
July 15, 2012

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.

Jobin Kuruvilla [Adaptavist]
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.
July 15, 2012

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?

Adam Steele July 15, 2012

@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.

Adam Steele July 15, 2012

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?

Adam Steele July 15, 2012

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).

Jobin Kuruvilla [Adaptavist]
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.
July 15, 2012

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?

Jobin Kuruvilla [Adaptavist]
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.
July 15, 2012

Can you add a screenshot with the filterprojectpicker type? Also are there any error in logs?

Adam Steele July 15, 2012

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.

Adam Steele July 15, 2012

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.'"

Jobin Kuruvilla [Adaptavist]
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.
July 15, 2012

Just to confirm, what happens when you clikc on the "Project" drop down? The definition looks fine to me.

David Kirchner February 20, 2013

I'm having the same problem. Here's the XML I am using:

&lt;property&gt;
                &lt;key&gt;projectid&lt;/key&gt;
                &lt;name&gt;report.issuecreation.projectid.name&lt;/name&gt;
                &lt;description&gt;report.issuecreation.projectid.description&lt;/description&gt;
                &lt;type&gt;filterprojectpicker&lt;/type&gt;
            &lt;/property&gt;

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.

David Kirchner February 20, 2013

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");

TAGS
AUG Leaders

Atlassian Community Events