Autofill Jira Versions
Use Case
When testing an application and reporting bugs, manually entering detailed information for each bug can become tedious. For example, even though the Affects Version(s) field is entirely dependent on the testing environment, you still need to manually fill in both the Affects Version(s) and Environment fields. This repetitive task is prone to errors and can be quite frustrating.
Fortunately, Golive can automate this process. By leveraging resources likeTrack Application Deployments and Environment Custom Fields, Golive automatically determines the correct deployed version and populates the Affects Version(s) field in Jira for you.
Solution
First, configure an custom field to link your Jira issues with Golive environments. In the example below, we've named this custom field Environment(s).
Once you set the Environment(s) custom field (1), the Affects Version/s field (2) is automatically set:

Have you managed to reproduce the bug on several environments? Select them all and all versions will be prefilled accordingly:
.png%3Falt=media?inst-v=aed4704f-776c-4b4e-9e8f-8289f9ca50e1)
Selecting several environments autofill several versions!
How does this work?
Prerequisites
You have configured your Golive Environments and filled the deployed versions.
You have created an Environment Custom Field and add it to your Bug screen.
You have ScriptRunner installed.
Configuration
Info
For this use case, we are using the ScriptRunner Jira App.
In ScriptRunner, create a new Behaviour.
where you want to automate version selection (e.g., Bug reports) :
.png%3Falt=media?inst-v=aed4704f-776c-4b4e-9e8f-8289f9ca50e1)
Within the newly created Behavior, add a server-side script to interact with your Golive custom field:
.png%3Falt=media?inst-v=aed4704f-776c-4b4e-9e8f-8289f9ca50e1)
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?
Setting up Jira can be complex for beginners. That's why we offer free assistance with configuration. If you need help, please to contact us contact us.