Skip to main content
Skip table of contents

Autofill Jira Versions


Use Case

When you are testing an application and opening bugs, you may be bored by setting lots of information to qualify each of the bug you create. For example, even if the “Affects version(s)” depends totally on the environment you are performing the tests on, you have to set manually both “Affects version(s)” and “Environment” fields. This a repetitive and error prone manual operation that you may want to get rid of.

Thanks to Track Application Deployments and Environment Custom Fields, Golive can automatically deduce the right deployed version and set the "Affects Version/s" Jira field for you.


Solution

You should first configure an Environment Custom Fields used to link your Jira issues with Golive environments. In the example below, we have name this custom field “Environment(s)”.

Once you set the “Environment(s)” custom field, the “Affects Version/s” field is automatically set:

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!


How does this work?

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:

GROOVY
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.apwide.env.api.GoliveAccessor

@WithPlugin("com.holydev.env.plugin.jira-holydev-env-plugin")
@PluginModule
GoliveAccessor goliveAccessor

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

// Get the list of versions deployed on selected Environments
def deployedVersionNames = envIds
    .collect { envId -> goliveAccessor.golive().environments.getById(envId).deployment?.versionName }
    .findAll { versionName -> versionName != null }

// Update the "Affects Version/s" field with the deployed versions
getFieldById("versions")?.setFormValue(deployedVersionNames)

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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.