Please help me to figure out how I can configure a JMWE workflow condition to do the following.
Check that all issues of a specific issuetype which are linked with a specific link type, have a specific value in a custom field and ignore any linked issues that may exist which are not of the specific issuetype/link type combination.
Example: A "Feature" issue should only allow a workflow transition to "Committed" if ALL issues of issuetype "CommitTask" that are linked by the "Is Related to by" link type have the string value of "Fully Committed" in a custom single line text field called "Commitment Level".
If any other issuetypes are linked by the "Is Related to by" Link Type, they should be ignored.
If any other issuetypes are linked by any Link Type, they should be ignored.
If any "CommitTask" (the target) issues are linked by a different Link Type (for example "Relates to"), they should be ignored.
Only linked issues of type "CommitTask" which are linked with the "Is Related to by" link type should be evaluated to see if they ALL have the "Fully Committed" string value in their "Commitment Level" field. If they all do, then the transition should be allowed. If only some or none have that in their "Commitment Level" field, then the transition should not be allowed (be hidden).
If there are no issues at all that are of the target issuetype/link type combination, then the Transition should not be allowed.
I have figured out how to create Conditions that evaluate some variations on this, such as checking if at least one issue of the target issuetype that is linked by the target link type, has the target value in its field. But the case above has me stumped. When it comes to Groovy scripting I'm afraid that I'm about as dumb as a bag of hammers (although in time I hope to change that!).
Any help would be greatly appreciated!! :)
Hi Andy,
Try this:
//If there are no issues at all that are of the target issuetype/link type combination, then the Transition should not be allowed.
if(!issue.getLinkedIssues("Is Related to by") || issue.getLinkedIssues("Is Related to by").findAll{it.issuetype.name == "CommitTask"} == null)
return false;
//linked issues of type "CommitTask" which are linked with the "Is Related to by" link type should be evaluated to see if they ALL have the "Fully Committed" string value in their "Commitment Level" field. If they all do, then the transition should be allowed.
return issue.getLinkedIssues("Is Related to by").findAll{link ->
link.issuetype.name == "CommitTask"}.every{iss ->
iss.getAsString("Commitment Level") == "Fully Committed"}
//Ignore all the other cases and pass
return true;
Regards,
Radhika
A couple of corrections:
//If there are no issues at all that are of the target issuetype/link type combination, then the Transition should not be allowed.
if(!issue.getLinkedIssues("Is Related to by")?.any{it.issuetype.name == "CommitTask"})
return false;
//linked issues of type "CommitTask" which are linked with the "Is Related to by" link type should be evaluated to see if they ALL have the "Fully Committed" string value in their "Commitment Level" field. If they all do, then the transition should be allowed.
return issue.getLinkedIssues("Is Related to by").findAll{link ->
link.issuetype.name == "CommitTask"
}.every{iss ->
iss.getAsString("Commitment Level") == "Fully Committed"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Radhika and David! I'm going to try this shortly and I'll reply to let you know how it goes.
I presume that for this I would use the "Scripted (Groovy) Condition (JMWE add-on) " Condition and not the "Linked Issues Condition (JMWE add-on)" Condition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct. Although you could also implement the same with 2 "Linked Issues Condition (JMWE add-on)" Conditions - one to force the existence of at least one CommitTask linked through the "Is Related to by" link type, and one to check that they all have the Fully Committed Commitment Level.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.