Version Autofill
Automatically select your "Affects Version/s" or "Fix Version/s" based on the selected Environment

Use Case

Sometimes, it may be challenging to remember what version is deployed on the Environment where you are performing your tests. Golive helps you track what version is deployed on each Environment, but what if it could automatically fill your "Affects Version/s" Jira field?
"Affects Version/s" field is prefilled based on "Environmen(s)" field selection
Have you managed to reproduce the bug on several Environments? Select them all and all versions will be prefilled accordingly:
Selecting several Environments can autofill several versions

Configure your Automation

Prerequisites

Configuration

For this use case, we use the ScriptRunner Jira App. In ScriptRunner, create a new Behaviour and map it with the relevant Jira issue types:
ScriptRunner Behaviour configuration
Then, add a server-side script for your Golive Environment Custom Field:
1
import com.atlassian.jira.issue.customfields.CustomFieldType
2
3
// Get the list of Environments' IDs from the Environment CF
4
def envField = getFieldByName("Environment(s)")
5
List<String> envIds = envField ? (List) envField.getValue() : null
6
7
// Get the list of versions deployed on selected Environments
8
CustomFieldType environmentCustomFieldType = customFieldManager.getCustomFieldType('com.holydev.env.plugin.jira-holydev-env-plugin:holydev_environment_customfield')
9
List deployedVersionNames = envIds.collect { envId ->
10
environmentCustomFieldType.getSingularObjectFromString(envId).getDeployedVersionName()
11
}
12
13
// Update the "Affects Version/s" field with the deployed versions
14
def versionField = getFieldById("versions")
15
versionField.setFormValue(deployedVersionNames)
Copied!
The script will do the following, each time you are updating your "Environment(s)" field:
  1. 1.
    Get the list of Environments selected in the "Environment(s)" field
  2. 2.
    Get the list of versions deployed on the selected Environments
  3. 3.
    Fill the "Affects Version/s" field with these versions
If you would like to prefill the "Fix Version/s" field instead, change the line 14 for:
1
def versionField = getFieldById("fixVersions")
Copied!

Questions?

The setup may be a little complex for Jira beginners, that’s why we offer free assistance for this configuration. If you need our help, contact us now.