Create on transition if parent matches JQL?

Esther Strom March 27, 2018

I've been using the COT plugin for a while and finding it really helpful. I have a new requirement that I'm a bit stumped on, though, and I'm wondering if the conditions are just too much for this plugin. And if so, what other options do I have?

We have a custom multi-line text field called Code Objects that are used with one specific component. I need to create a subtask on transition if there's a partial or complete match in that field for a specified list (array?) of strings. Basically, if the issue being transitioned would be found by the following JQL, a subtask needs to be created.

project = PH AND cf[10204] is not EMPTY AND (cf[10204] ~ WEB OR cf[10204] ~ SUS OR cf[10204] ~ POSSEND OR cf[10204] ~ PINOTIF OR cf[10204] ~ PIMAIL OR cf[10204] ~ WRCCTOKEN OR cf[10204] ~ VSATTEST OR cf[10204] ~ WREXTCODE OR cf[10204] ~ WRMASTER OR cf[10204] ~ WRPEDIT OR cf[10204] ~ WRLDSTR OR cf[10204] ~ WRTOPPRULE OR cf[10204] ~ OUTOFPROD)


Is this possible? It seems a bit much for a regex.

1 answer

0 votes
Amith Mathur {Appfire}
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.
April 9, 2018

Hi @Esther Strom

The JQL query should work. However, you just need to replace the custom field id with the custom field name in the JQL of the Create on Transition post function. Ensure to use % at the start and end of the custom field name. 

project = PH AND %customfieldname% is not EMPTY AND (%customfieldname% ~ WEB OR %customfieldname% ~ SUS OR %customfieldname% ~ POSSEND OR %customfieldname% ~ PINOTIF OR %customfieldname% ~ PIMAIL OR %customfieldname% ~ WRCCTOKEN OR %customfieldname% ~ VSATTEST OR %customfieldname% ~ WREXTCODE OR %customfieldname% ~ WRMASTER OR %customfieldname% ~ WRPEDIT OR %customfieldname% ~ WRLDSTR OR %customfieldname% ~ WRTOPPRULE OR %customfieldname% ~ OUTOFPROD)

Alternatively, you can also use the | symbol for the values as shown below

Conditions:
Condition value: %original_customfieldname%, Regex pattern: value1|value2|value3|value4|value5

 

Thanks,
Amith Mathur

Esther Strom April 13, 2018

It's good to know that it SHOULD work; I just can't seem to make it happen. In the interest of simplifying during testing, I tried setting up only one string to search for. 

Here's my setup (note that the Create Subtask postfunction is actually the final step, after the Generic Event; I just took the screenshot before moving it):

 

postFunction.png

And here's a search to show that there is at least one ticket that should match the regex I set up. In that ticket, the value in the multi-line custom field is "WRPEDIT.int", which according to RegExr does match the expression I'm using in the regex.

search.png

So where am I going wrong? 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events