Forums

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

JMWE testing value of sub-task issue type (condition)

Tomáš Vrabec
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.
August 22, 2019

Hi, 

need to check in the condition if sub-task of specific type already exist.

If exist, transition is not allowed.

I ended with 

issue.get("subtasks")?.any{it.getIssueType().getName() != "Server Config IP"}

which is working, but only for checking the first one in array

If the subtask is not first in the array, its always true.

2 answers

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
August 22, 2019

Hi @Tomáš Vrabec ,

your code actually tests if any subtask is not of type "Server Config IP". Replace != with == and you'll get the desired result.

Tomáš Vrabec
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.
August 23, 2019

 

Hi @David Fischer  its intended.

Attaching screen of transitions in workflow.

screenshot 25.pngEach transition generating different sub-task type.

Each transition got the same mentioned condition.

When I create "Server Config IP" subtask, first transition is hiding as expected. 

When I create all of three others, transitions are still shown, even condition is very the same, just with different getName comparison.

Working on workaround via custom fields, but still this would be nicer solution. 

David Fischer
Community Champion
August 23, 2019

If I understand correctly, you want each transition to be visible (available) only if there is no corresponding subtask, correct? In that case, your condition should be:

!issue.get("subtasks")?.any{it.getIssueType().getName() == "Server Config IP"}

(note the leading ! and the ==)

which means "there is no subtask whose issue type is Server Config IP" 

Like Tomáš Vrabec likes this
Tomáš Vrabec
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.
August 26, 2019

Yep, that did the job. Thanks David and have a nice day!

0 votes
Tomáš Vrabec
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.
August 22, 2019

Definitelly @David Fischer will know the answer, just posted it here so others can found it in future.

(and me as well) :-) 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events