Simple Scripted Condition to validate issue transition against another issue with common custom fields

Hello,

I'm new to Groovy and would like to use a condition to validate the transition of an issue.

Issue Types:

D, R, & RS

Custom Fields:

TR & DA

Scenario:

Given the current issue (type = D) with custom field TR (value = 1) and custom field DA (value = VP).

Is there an issue of type R (in the same project) with custom field TR having the same value of the current issue (value = 1)?

AND

Does the issue of type R have a subtask issue of type RS with custom field DA having the same value of the current issue (value = VP)?

Thank you,

Jack

1 answer

1 accepted

This widget could not be displayed.

Gawd... this reminds me of sitting through maths lectures.

It's hard to follow through what you are saying, but your first task is to write a JQL for some sample values. For the sub-task part of your query, you could use parentsOf("issuetype = RS and DA = somevalue")

In the script runner there is a built-in condition which uses a jql query to check whether the user can do the transition. You can't use this alone though because you need to substitute one or more common values.

So you could look at the code for com.onresolve.jira.groovy.canned.workflow.conditions.JqlQueryCondition, convert it to a script, and modify the query to substitute in your values.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

76 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you