---
title: "Assign Environment based on the version name"
canonical: "https://help.releasemanagement.app/space/RMC/4045570049/Assign%20Environment%20based%20on%20the%20version%20name"
format: markdown
---
> Macro (include)

# Troubleshooting?

> ℹ️ Have issues running Release Automation rules? Please check our troubleshooting guide - [https://releasemanagement.atlassian.net/wiki/spaces/RMC/pages/2522284033/Release+Automation+for+Jira+Triggers+Conditions+Actions#%F0%9F%86%98-Troubleshooting-Automation-Rules](https://releasemanagement.atlassian.net/wiki/spaces/RMC/pages/2522284033/Release+Automation+for+Jira+Triggers+Conditions+Actions#%F0%9F%86%98-Troubleshooting-Automation-Rules).

# Topics

> Macro (toc)

# Introduction

In the use case below, the environment should be assigned based on the version name.

## Assumptions

1. We will configure this rule on the version. The rule will be triggered when the version is created.
2. If the version has “-RC1“ in the name, it should be automatically assigned to the UAT enviornment, in other case, it should be automatically assigned to STG

## Solution overview

In order to do so, we will create a Release Management automation rule that will run Jira Automation to execute the rule and make a relevant call to the Release Management app to update the environment

# Prerequisites

## Get quick URLs for the environment we will use for the version assignment.

1. Open the release management board
2. Open UAT environment
  1. Navigate to versions and copy the URL from the tab
3. Open Production environment
  1. Store URL for the Production environment as well

## Generate personal API token

Generate a personal API token by following the guide below:

[https://releasemanagement.atlassian.net/wiki/spaces/RMC/pages/3168108545](https://releasemanagement.atlassian.net/wiki/spaces/RMC/pages/3168108545) 

# Step 1: Create a Jira Automation rule to enviornment

Create a new rule 

## Add trigger “Incoming webhook“ 

Select “No work items from the webhook“ option

![image-20250516-132911.png](media://07e3837f-20aa-422f-ad27-a4099929d0e5)

## Add If block

Add if block 

![image-20260518-163214.png](media://b01b72a2-12e6-45a2-8745-9a416f86385c)

 

Add Smart Values condition

- First value: {{webhookData.entityName}}
- Condition: Contains
- Second Value: -RC1

![image-20260518-163103.png](media://b61d74c2-ba6a-49a5-9dbe-f7c39feab84b)


## Add Send Web Request action after IF

![image-20260518-163346.png](media://89f373a4-f68a-4af8-8d8c-f21d9e9fe6c4)

- Web request URL: URL for the UAT environment that we copied at the beginning. In this URL, please replace the version ID with *{{webhookData.entityId}}*
  - Example: [https://rmcloud-prd.releasemanagement.app/api/1/environment/661cde179ed1sdfsfdfdf14/version/%7B%7BwebhookData.entityId%7D%7D](https://rmcloud-prd.releasemanagement.app/api/1/environment/661cde179ed1sdfsfdfdf14/version/%7B%7BwebhookData.entityId%7D%7D)
- Method: **POST**
- Web request body: **Empty**
- Delay execution of subsequent flow actions until we've received a response for this web request: **Enabled**
- Add Header:
  - Key: **X-RM-Token**
  - Value: **Token you have generated at the beginning**

## Add the Send Web Request action in the Else statement

Do the same as for the previous step, but with the URL for the production environment

## Save the rule

Save the rule and copy the Webhook URL and Secret from the incoming webhook step.

> ℹ️ Please find the rule example attached:

# Step 2: Create a Release Automation rule to trigger Jira Automation on versionis cerated

Open board settings, navigate to Automation, and create a new automation rule  

Set the scope to Version

**Add trigger**: “Version Created“

![image-20260518-164132.png](media://0f109393-1c40-4d10-989b-2cdf8d0bfee0)


**Add Action:** Invoke Jira Automation

Put your name, add the URL, and the Secret from the Jira automation rule 

![image-20250516-134628.png](media://25f48007-f2e1-40c9-82a9-b7d9255ea62a)

Save the rule 

Try to create the version

Check if the Release Management and Jira Automation rules are executed without errors and if the work item is successfully created.

![image-20250516-134903.png](media://0e3fc1f6-f7d2-47e6-8fee-deaaed229856)

> Macro (include)