Clone wiki

projectspecificselectfield-public / Home

Project Specific Select Field

images/jpssf_banner_460x225.jpg

This plugin provides new custom field types based on single and multi select field, where the project admin is able to define the values for the select field specifically for his project resp. the corresponding custom field context. (In standard JIRA the option values of a select field can only be managed by a JIRA admin.)

Auto-complete and filter criteria selection in JIRA search as well as use of the custom field in Pie Chart, Issue Statistics and Two-Dimentional Filter Statistics gadgets is supported.

Configuration

Adding a Project Specific Custom Field

After installation of the add-on go to JIRA administration and add a custom field of type

  • Project Specific Select Field
  • Project Specific Multi Select Field
  • Project Specific Select Field (simple) -- This custom field type is deprecated (see details below)


images/add-thumbnail.png


Please choose the required custom field type Project Specific Select Field or Project Specific Multi Select Field. If you want to use Project Specific Select Field (simple), please notice that this custom field type is deprecated (see details below)

In the next step you have to provide a name (mandatory) of the custom field type and a description (optinal). You also have to add one first option value (mandatory) for the global custom field context created by default.


images/1_select_custom_field_type-thumbnail.png images/2_add_name_and_option-thumbnail.png


When you now go to configuration of the custom field, you see that there is a default configuration scheme has been created. This configured by default for all issue types and all projects. Please delete this, because it is not needed.


images/3_delete_global_context-thumbnail.png


Then click to add new context and select one project from the provided list of possible projects. Create a second, third etc. new context each time selecting another project.


images/4_create_context_per_project-thumbnail.png


If you select more then one project when adding a new context, then this means, that all selected projects will share the list of option values and every project administrator can edit this shared list of option values.

You can have as much custom fields of this type as needed incl. full support for default values, setting fields to required in field configurations etc. To set the option values leave administration and open the corresponding project.

Adding Option Values to a Project Specific Select Field

There is a new project administrator tab called Project Specific showing custom fields of type Project Specific Select Field, Project Specific Multi Select Field and Project Specific Select Field (simple) relevant for this project.

The project admin can add option values for the custom fields, which then are used in create, view and edit issue dialogs and for searching. He can also order and edit them. Option values can also be disabled (these values are shown in grey color), so that they are no longer available in create or edit dialog, but old issues still can have this option value assigned. If you want to reactivate a disabled field value, simply re-enable it gain. -- Please notice that edit and order are not possible for custom fields of type Project Specific Select Field (simple).


images/edit-thumbnail.png


On an additional project tab you also find statistical information incl. option value, number of issues with this field value, percentage, bar chart and link to search. You also find a button in the upper right corner, which directs you to the project administration tab mentioned above.


images/tab-thumbnail.png


Deprecated Custom Field Type

Project Specific Select Fields (simple) is deprecated, because it has some limitations. On one hand there is no need to define a custom field context for each project, but because it is internally based on a text field, it cannot be used in Pie Chart, Issue Statistics and Two-Dimentional Filter Statistics gadgets and does not support auto-complete and filter criteria selection in JIRA search.

Converting Standard Single and Multi Select Field to Project Specific Select Field

It is easy to convert and existing JIRA standard single or multi select custom field to Project Specific Select Field, because the plugin internally uses JIRAs standard methods like option manager and custom field context and just exposes the admin UI for adding and disabling option values to project admins.

As described in the JIRA documentation, you can change custom field types using SQL on database level. (Please notice that this approach is not officially supported by Atlassian even if it is part of the JIRA documentation.)

  • Always back up your data before performing any modifications to the database. If possible, try your modifications on a test server.
  • Stop JIRA
  • Connect to the database and execute the following statement for converting a multi select custom field
-- Attention: Please contact me to verify this statement with you 
UPDATE customfield
    SET CUSTOMFIELDTYPEKEY = 'jira.plugin.projectspecificselectfield.jpssf:multicftype',
        CUSTOMFIELDSEARCHERKEY = 'jira.plugin.projectspecificselectfield.jpssf:multiselectsearcher'
  WHERE CFNAME = 'MyMultiSelect' and 
        CUSTOMFIELDTYPEKEY = 'com.atlassian.jira.plugin.system.customfieldtypes:multiselect';
  • Connect to the database and execute the following statement for converting a single select custom field
-- Attention: please contact me to verify this statement with you 
UPDATE customfield
    SET CUSTOMFIELDTYPEKEY = 'jira.plugin.projectspecificselectfield.jpssf:singlecftype',
        CUSTOMFIELDSEARCHERKEY = 'jira.plugin.projectspecificselectfield.jpssf:multiselectsearcher'
  WHERE CFNAME = 'MySingleSelect' and 
        CUSTOMFIELDTYPEKEY = 'com.atlassian.jira.plugin.system.customfieldtypes:select';
  • Restart JIRA
  • Reindex JIRA

REST API and SQL API

Project Specific Select Field custom fields and option values can be managed also via REST API and SQL API. For more details see here

Support

In case of problems or enhancement requests concerning the plugin, please raise an issue in the Issue Tracker or get in contact via email.

In case of questions on usage or configuration, please raise a question in Atlassian Answers and tag your question with "addon-jira.plugin.projectspecificselectfield.j".

Detailed Logging

In some cases detailed logging information might be useful. To enabled this for the plugin please go to Administration > System > Logging and Profiling and set jira.plugin.projectspecificselectfield.ProjectSpecificSelectTab, jira.plugin.projectspecificselectfield.util.OptionValuesManagerUtil resp. jira.plugin.projectspecificselectfield.rest.OptionValuesManagerRest to DEGUB.

Problems with ordering of option value

For custom fields of type Project Specific Select Field and Project Specific Multi Select Field options can be manually ordered by project admins via Project Specific tab in project administration or by JIRA admins in custom fields configuration.

Because of a bug in an older versions of the Project Specific Select Field plugin, you might experience problems in ordering of the option values. When moving options top, bottom, up or down, it feels like there are two groups of options in the list (the newly added options in the upper part and option values added longer time ago at the bottom) and you cannot move an option from the lower part to the upper part, but just inside a group of options at the top or inside the group at the bottom. This is because in early version of the plugin a partentOptionId was set, which should have been null.

To check, if this problem is relevant for your please use the following SQL. Is option values are returned, then these needs to be fixed in the next step.

-- Attention: Please contact me to verify this statement with you 
SELECT CUSTOMFIELD.ID, CUSTOMFIELDTYPEKEY, CFNAME, CUSTOMFIELDOPTION.ID, CUSTOMVALUE 
FROM CUSTOMFIELD, CUSTOMFIELDOPTION
WHERE CUSTOMFIELD.ID = CUSTOMFIELDOPTION.CUSTOMFIELD
AND (CUSTOMFIELDTYPEKEY = 'jira.plugin.projectspecificselectfield.jpssf:multicftype'
OR CUSTOMFIELDTYPEKEY = 'jira.plugin.projectspecificselectfield.jpssf:singlecftype')
AND PARENTOPTIONID is not NULL

To find out relevant custom field id please use the following SQL.

SELECT ID, CFNAME, CUSTOMFIELDTYPEKEY from CUSTOMFIELD
WHERE CUSTOMFIELDTYPEKEY = 'jira.plugin.projectspecificselectfield.jpssf:multicftype'
OR CUSTOMFIELDTYPEKEY = 'jira.plugin.projectspecificselectfield.jpssf:singlecftype' ;

To fix this problem you need to update the corresponding rows in table CUSTOMFIELDOPTION. There are option values in this table for the corresponding custom field, where PARENTOPTIONID is not null. Please update these rows using SQL.

-- Attention: Please contact me to verify this statement with you 
UPDATE CUSTOMFIELDOPTION
SET PARENTOPTIONID = NULL
WHERE CUSTOMFIELD = <your_custom_field_id> ;

Updating from Version 0.9

In general the update process is very easy. Just update using Plugin resp. Add-on Manager in JIRA and you are done. Only when updating from version 0.9 to 1.x there is some manual work to do. In table AO_9661E7_SELECT_OPTION the column CUSTOM_FIELD_ID will be changed from String to Integer during update, but you as a database administrator have to prepare the data a little bit. In CUSTOM_FIELD_ID in version 0.9 values like "customfield_10001" where stored, with version 1.x it is just the integer "10001".

  • Stop JIRA
  • Make backup of database in case something goes wrong
  • Open your database tool and execute the following statement (this one is specific for MySQL and might differe for other databases; please contact support in case you are not sure):
-- Attention: Please contact me to verify this statement with you
-- This statement works for PostgreSQL and Oracle databases; for other databases the SQL statements need little changes

UPDATE AO_9661E7_SELECT_OPTION SET CUSTOM_FIELD_ID = SUBSTR(CUSTOM_FIELD_ID, 13) 
WHERE CUSTOM_FIELD_ID LIKE 'customfield_%';
  • Restart JIRA and verify update by opening a project, swith to "Project Specific" tab and review field values and issue statistics shown there

If this fails, then automatic change of column CUSTOM_FIELD_ID from String to Integer of table AO_9661E7_SELECT_OPTION during update cannot be done automatically by JIRA. Then please follow the instructions below.

  • After shutdown and backup of your database execute the following statement to rename and create a new column with type Integer.
-- Attention: Please contact me to verify this statement with you
-- This statement works for Oracle database; for other databases the SQL statements need little changes

ALTER TABLE AO_9661E7_SELECT_OPTION
RENAME COLUMN CUSTOM_FIELD_ID TO CUSTOM_FIELD_ID_VARCHAR2;

ALTER TABLE AO_9661E7_SELECT_OPTION
ADD (CUSTOM_FIELD_ID NUMBER(20));

UPDATE AO_9661E7_SELECT_OPTION
SET CUSTOM_FIELD_ID = TO_NUMBER(REPLACE(CUSTOM_FIELD_ID_VARCHAR2 ,'customfield_'));
  • Restart JIRA and verify update by opening a project, swith to "Project Specific" tab and review field values and issue statistics shown there

images/marketplace_available_dark_180x80.png

Updated