Writing your first Groovy script
You need not create a Calculated text custom field type for this. The imported backup has everything in place.
Writing the script
Step 1 - Navigate to the Groovy formula in the field configuration
- Go to the Administration icon and click on it.
- Go to Issues - > Custom fields
- Locate the custom field Issue Key
- Click on the cog wheel and click on
Configure.
- Click on
Edit Groovy Formula.
Step 2 - Write the script
In the editor, click on Issue Fields tab of the Groovy editor.
Select the field "Key" from "Select a field" drop-down
- Click on the button with text
issue.get("issuekey")
under the "Accessing the fields" section The following code gets inserted into the Groovy editor
issue.get("issuekey")
Your custom field configuration should look like this:
Step 3 - Test your script
- Click on
Test Groovy Script
. - Input the issue key
GIJ-1
- Click on
Test
- The following result will be displayed.
Step 4 - View the custom field value on the issue view
- Save the formula.
- Perform a re-index as suggested by Jira
- Go to the issue
- Verify that the field Key displays the key of the issue.