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

Retrieving Project Field Values From an External Plugin and Inputting into my Report Plugin

tommy guo
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.
August 5, 2013
I have been working on a report that retrieves project-level information, though it is based on an issue-level Filter. I have managed to retrieve a few fields like Project ID, Project Name, Release and Lead Developer. I need to retrieve and display two more fields namely : Target End Date and Status Details. These are not custom fields. These are project Fields created by the plugin "ProFields". is there any way in which I can retrieve the values of these fields using the standard atlassian library classes in my velocity template?? Many Thanks!

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
mahalakshmi balasubramanian August 8, 2013

The solution to this is a database access. I dont think there are standard atlassian library classes that help you retrieve fields created by third party plugins. Moreover, the fields are not custom fields as well.

The best SOLUTION would be to :
- get the jdbc:sqlserver driver installed
- add the jar files to the build path of your package
- import the necessary classes from the jar to your java code
- and connect to the sqlserver database using the syntax for standard jdbc:sqlserver connectivity.

It makes querying the "pro fields" created by the external plugins easier.
You can store the results of the sql query in a SET and then the transfer the individual columns using their index to a hashtable.

tommy guo
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.
August 8, 2013

Finally, someone that understands the question at hand.

1 vote
EddieW
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.
August 5, 2013

Even if created by a plugin they should be Custom Fields, and available via the same methods. You can take a look at http://localhost/rest/api/2/field, to verify. These values should be available

issue.getCustomFieldValue("customfield_XXXXXX");

Marten Kreienbrock
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.
August 5, 2013

I would also think, this will be the solution to the problem. However, if you don't know the id of the Customfield, you can also try to get it by name:

Collection<CustomField> dev1 = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("fieldName");
CustomField[] dev0 = new CustomField[5];
dev0 = dev1.toArray(dev0);
issue.getCustomFieldValue(dev0[0]));

TAGS
AUG Leaders

Atlassian Community Events