How-to configure the Customfield
Deprecated and Removed with 5.0
Statement starting from version 5.0: Due to some changes in Jira 9.0 we had to remove our custom fields. So they are no longer available since version 5.0.
Statement till version 5.0: The field types "JIRA Metadata - View project metadata field" and "JIRA Metadata - Calc. field" should no longer be used.
We recommend using "Scriptrunner for Jira" as a replacement.
- How-to use Metadata values within Custom script post-functions
- How-to use Metadata values within Scripted Fields
Or our Post Function
This page will show you, the provided customfield types.
Be aware that you have to perform a project re-index, If you change some metadata value which was used within a searchable field. Otherwise the search-index of Jira will contain the old metadata value.
The configuration will be explained using the following examples.
Sample 1 : metadata that should be displayed at every Issue (eg. the account info (accounting.code))
Sample 2 : metadata that should be used to calculate an Issue related Amount (eg. the hour rate (accounting.hour.rate))
Sample 3 : metadata that should be displayed at the Project Metadata Tab (eg. contact person or the contact person phone number)
Step-by-step guide
Value Configuration
Go, as Project-Admin, into the project overview of the project of your choice (referenced as SampleProject) and select the tab JIRA Metadata.
Enter the following data within the Edit Metadata Section:Key Value Goup hidden Sample 1 accounting.code PK-23-Sys-3 true Sample 2 accounting.hour.rate 12.5 true Sample 3 a Project Contact Person Mayerson Project Infos false Sample 3 b Project Contact Person Phone 555-454-3422 Project Infos false Sample 3 c External Project Key PK-23 false The result:
- Field Configuration
Let's make the Sample 1 and Sample 2 run within your JIRA, but login as JIRA Administrator first. - Sample 1
- Goto Adminstration => Custom Fields
- Click "Add Custom Field"
- Select the Field Type: "JIRA Metadata - View project metadata field" and click "Next"
- Insert as Field Name: "Account Info"
- Select as Search Template the "Text Searcher" or "None" (do not select the "Exact Number Searcher" or the "Number Range Searcher")
- Click "Finish"
- Click "Edit Default Value" on the "Configure Custom Field: Account Info" page
- Insert "accounting.code" and click "Set Default"
- The "Account Info" field with the metadata value will be displayed for every issue of your SampleProject (you may have to re-login to see the result).
- Sample 2
- Goto Adminstration => Custom Fields
- Click "Add Custom Field"
- Select the Field Type: "JIRA Metadata - Calc. field" and click "Next"
- Insert as Field Name: "Amount"
- Select as Search Template the "Exact Number Searcher" or the "Number Range Searcher"
- Click "Finish"
Click "Edit Default Value" on the "Configure Custom Field: Account Info" page
Insert the following velocity script and click "Set Default"
#set( $accRate = $metadataService.getMetadataValue($issue.projectObject, 'accounting.hour.rate') ) #set( $issueTime = $math.div($issue.timeSpent, 3600) ) #set( $amount = $math.mul($accRate, $issueTime) ) $!amount
- The "Amount" field with the result of the above velocity script will be displayed for every issue of your SampleProject (you may have to re-login to see the result).
Background Information for Sample 2
You can use the following parameters within your velocity script:
issue (details: http://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/Issue.html)
customField (details: http://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/fields/CustomField.html)
metadataService (provides the method: String/Double getMetadataValue(Object, String) e.g: $metadataService.getMetadataValue($issue.projectObject, 'accounting.hour.rate')
math (details: http://velocity.apache.org/tools/devel/generic/MathTool.html)
customFieldLookupService (provides the method: String/Double getCustomFieldValue(Issue, String) e.g: $!customFieldLookupService.getCustomFieldValue($issue, 'customfield_10000')
Related articles