Skip to main content
Skip table of contents

Autofill Jira Versions


Use Case

When testing an application and reporting bugs, manually entering extensive information for each bug can become tedious. For example, although 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. Leveraging Track Application Deployments and Environment Custom Fields, Golive can automatically determine the correct deployed version and populate the "Affects Version(s)" field in Jira 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 named this custom field “Detected in”.

Once you set the “Detected in” custom field (1), the “Affects versions” field (2) is automatically set:

image-20240515-144052.png

How does this work?

Prerequisites

Configuration

For this use case, you can create a Jira Automation rule called “Autofill Affects Versions”:

image-20240515-171251.png

Trigger

The rule triggers when the “Detected in” field is updated.

image-20240515-170957.png

Condition

It only runs when “Affects versions” is empty, to give users the possibility to overwrite the information if needed.

image-20240515-171429.png

Action 1 - Send web request

To get the environment ID(s) added to the environment field “Detected in”.

image-20240515-171526.png

Web request URL

If needed, replace “Detected%20in” by the name of your Environment field (%20 is used for space - more information about URL encoding).

CODE
https://golive.apwide.net/api/customfield/environment/selected?issueKey={{issue.key}}&customfieldName=Detected%20in

Headers

To generate a token, refer to the “API Token Authentication” section on this page: Rest API

Action 2 - Send web request

To get the Golive information for the selected environment(s).

image-20240515-172606.png

Web request URL

CODE
https://golive.apwide.net/api/environments/search/paginated

Custom data

CODE
{
  "criteria": [
    {
      "name": "environmentId",
      "values": [
       {{webResponse.body.items.id}}
      ]
    }
  ]
}

Headers

You can reuse the same token than the one used in the previous action.

Action 3 - Create version

To create the corresponding versions if they do not exist in the Jira project already:

image-20240515-172942.png

Version name

CODE
{{webResponse.body.environments.deployment.versionName}}

Action 4 - Edit issue fields

To update the “Affects versions” field:

image-20240515-173149.png

Affects versions

CODE
{{webResponse.body.environments.deployment.versionName}}

Additional fields

CODE
{
    "fields": {
       "versions": [
            {{#webResponse.body.environments.deployment}} { "name" : "{{versionName}}" } {{^last}}, {{/}} {{/}} 
        ]
    }
}

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.image-20240515-143520.png

JavaScript errors detected

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

If this problem persists, please contact our support.