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:

import com.atlassian.jira.issue.customfields.CustomFieldType

// Get the list of Environments' IDs from the Environment CF
def envField = getFieldByName("Environment(s)")
List<String> envIds = envField ? (List) envField.getValue() : null

// Get the list of versions deployed on selected Environments
CustomFieldType environmentCustomFieldType = customFieldManager.getCustomFieldType('com.holydev.env.plugin.jira-holydev-env-plugin:holydev_environment_customfield')
List deployedVersionNames = envIds.collect { envId ->
    environmentCustomFieldType.getSingularObjectFromString(envId).getDeployedVersionName()
}

// Update the "Affects Version/s" field with the deployed versions
def versionField = getFieldById("versions")
versionField.setFormValue(deployedVersionNames)
GROOVY

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.