I want to block a transition if fixversion contains "-UPDATE" in it

Yugandhar Kumar Chintamaneni
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 4, 2024

Hi,

I want to write automation rule to block a transition if fixversion contains "-UPDATE" in it.

is it possible?

2 answers

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 5, 2024

Hi @Yugandhar Kumar Chintamaneni -- Welcome to the Atlassian Community!

Automation rules trigger after an event has occurred, such as an issue transition.  They cannot block or prevent the event.

Instead investigate using workflow validators, perhaps from an addon, to prevent the transition.

Kind regards,
Bill

0 votes
Mikel Garcia Bartolome July 4, 2024
  1. Navigate to Automation Rules:

    • Go to your Jira Cloud instance.
    • Click on the gear icon (⚙️) to go to the Jira settings.
    • Select "System" and then "Global Automation" or "Project Automation" under "Automation" depending on whether you want this rule to apply globally or to a specific project.
  2. Create a New Rule:

    • Click on "Create Rule" to start a new automation rule.
  3. Add Trigger:

    • Select a trigger that corresponds to a transition, such as "Issue transitioned".
  4. Add Condition:

    • Click on "New condition" and select "Advanced compare condition".
    • Configure it as follows:
      • First value: {{issue.fixVersions.name}}
      • Condition: contains
      • Second value: -UPDATE
  5. Add Action:

    • Add an action to block the transition.
    • Jira Automation does not directly support blocking transitions, so you can instead add an action to notify the user and possibly move the issue back to its previous status or set a flag.
    • For example, you can use the "Edit issue fields" action to add a comment explaining why the transition is not allowed.
  6. Complete the Rule:

    • Give your rule a name and description.
    • Turn on the rule.

Here is an example of how you might configure the rule in detail:

Step-by-Step Example

  1. Create a new rule:

    • Click on "Create Rule".
  2. Add Trigger:

    • Choose "Issue transitioned" trigger.
    • Configure the transition details (e.g., "From status" and "To status").
  3. Add Condition:

    • Click on "New condition".
    • Select "Advanced compare condition".
    • Configure the condition:
      • First value: {{issue.fixVersions.name}}
      • Condition: contains
      • Second value: -UPDATE
  4. Add Action (Notify User and Move Issue Back):

    • Click on "New action".
    • Select "Send email" or "Send Slack message" to notify the user that the transition is blocked.
      • Email Example:
        • To: Assignee (or Reporter, or any other appropriate user)
        • Subject: Transition Blocked
        • Body: The transition was blocked because the fixVersion contains "-UPDATE".
    • Optionally, add another action to transition the issue back to the previous status or to set a flag:
      • Click on "New action".
      • Select "Transition issue" to move it back to the previous status.
  5. Save and Activate the Rule:

    • Name your rule (e.g., "Block Transition for -UPDATE in fixVersion").
    • Turn on the rule.
Mikel Garcia Bartolome July 4, 2024

Here's an example of how the rule might look in JSON format if you export it from Jira (you can format JSON here):

{
"name": "Block Transition for -UPDATE in fixVersion",
"trigger": {
"type": "issueTransitioned",
"config": {
"statusFrom": ["Any Status"],
"statusTo": ["Any Status"]
}
},
"conditions": [
{
"type": "advancedCompareCondition",
"config": {
"firstValue": "{{issue.fixVersions.name}}",
"compareType": "contains",
"secondValue": "-UPDATE"
}
}
],
"actions": [
{
"type": "sendEmail",
"config": {
"to": "assignee",
"subject": "Transition Blocked",
"body": "The transition was blocked because the fixVersion contains \"-UPDATE\"."
}
},
{
"type": "transitionIssue",
"config": {
"status": "Previous Status"
}
}
]
}

Yugandhar Kumar Chintamaneni
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 5, 2024

Hi @Mikel Garcia Bartolome ,

Thanks for your reply.

Comparison worked and I am able to add a comment.

But issue is that it is transitioned to the next state. I want to block it and keep it in the previous status only.

in the below example it should be in Test in progress. But it is in workdone after i run this rule

status.PNG

Mikel Garcia Bartolome July 5, 2024

In Jira Automation, there isn't a direct way to "block" a transition during the event itself, but you can simulate this by immediately transitioning the issue back to its previous status if it contains "-UPDATE" in the fixVersion. Here is how you can set up the rule:

Add Action to Transition Back:

  • Click on "New action".
  • Select "Transition issue".
  • Configure it to transition the issue back to the previous status.
  • Use the smart value {{fieldChange.fromString}} to transition it back to its previous status.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events