Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

looking for workflow post validation for prevent Story to transition upon multi conditions

Gilad Shtern
Contributor
August 27, 2023

Hi,

 

I'm looking for workflow post validation for prevent Story to transition when:

1)Bug is linked into Story with,

2)Severity: S1 or S2,

3)Status: Done, Cancelled.

While, other bug severities ae allowed or any different issue type.

Post validator:

(linkedIssue.getAsString("issuetype") in ["Bug"]) && (!linkedIssue.getAsString("Severity") in ["Very High", "Critical"] || (linkedIssue.getAsString("status") in ["Done", "Cancelled"] && linkedIssue.getAsString("Severity") in ["S2", "S1"]))

 

Kindly,

Gilad

1 answer

0 votes
Mohanraj Thangamuthu
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 27, 2023

Hello, Good day. At the moment we don't have option to use JQL in condition and we have open FR : https://jira.atlassian.com/browse/JRACLOUD-67451

Screenshot 2023-08-28 at 11.12.47 AM.png

 

You can create a workaround to check the JQL after an issue is transitioned and if its not matching the JQL condition, then the rule can move the issue back to previous status.

Gilad Shtern
Contributor
August 28, 2023

Is it the same with Data Center?

-Gilad

Mohanraj Thangamuthu
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 28, 2023
Gilad Shtern
Contributor
August 28, 2023

I'm trying a different approach, but it fails:

 

import com.atlassian.jira.component.ComponentAccessor
//Get necessary managers
def cfm = ComponentAccessor.customFieldManager
def linkManager = ComponentAccessor.issueLinkManager
def severity = cfm.getCustomFieldObjectByName("Severity")
def issueSeverityValue = issue.getCustomFieldValue(severity) String
def issueProject = issue.getProjectId()
def issueKeys = []
//Go through all linked issues and collect their keys
 linkManager.getOutwardLinks(issue.id).each{
 def linkedIssue = it.destinationObject
 def linkedIssueProject = linkedIssue.getProjectId()
 def linkType = it.getIssueLinkType()
 def linkedIssueSeverityValue = linkedIssue.getCustomFieldValue(severity) String
 def linkedIssueStatus = linkedIssue.getStatus()
 def linkedIssueStatusName = linkedIssueStatus.getName()
 
 if(linkType.getInward() == "created" &&
 issueSeverityValue in ["Very High", "Critical"] &&
 !(linkedIssueStatusName in ["Done", "Cancelled"]) )
 {
 issueKeys.add("${linkedIssue.key}")
 }
 }
if(issueKeys.size() == 0)
{
 return println(issueKeys.size())
}
else
{
 return println(issueKeys.size())
}

Suggest an answer

Log in or Sign up to answer