Forums

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

Validate status of a particular sub-task in workflow

Krishnanand Nayak
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.
September 18, 2018

I need help with the following Script runner code. We need to check the status of a particular subtask before it can be transitioned. When i use the below code the validation doesn't work

passesCondition = true
def subTasks = issue.getSubTaskObjects()

subTasks.each {
if (it.summary =~ "Gap Analysis" && it.status == "Done")
passesCondition = false
}

 

2 answers

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
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.
September 27, 2018

Break up the two clauses - which one of the summary or status is failing?  (or both?)

Krishnanand Nayak
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.
September 27, 2018

ok let me try and see.

Krishnanand Nayak
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.
September 27, 2018

both of them are failing. Here is what we are trying to achieve:

On a story we want to validate if the subtask with the summary as "Gap Analysis" has a status "Done" before the story can be transitioned. The story has 3 subtasks.

Nic Brough -Adaptavist-
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.
September 27, 2018

Ok, I was sort of expecting the status one to fail, not both.  Try

"Done".equals(it.getStatus().getName())

That's the raw Java of what you're doing that explicitly gets and tests strings.  I think you'd do the same for summary but with "contains" rather than "equals"

0 votes
Krishnanand Nayak
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.
September 20, 2018
Krishnanand Nayak
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.
September 27, 2018

Suggest an answer

Log in or Sign up to answer