Create subtask with a "Conditional execution" on summary-field

Issue #472 resolved
Maximilian Peter created an issue

I'm trying to configure a validator between a field on the main ticket and the existence of a subtask.

I implemented a transition "Action1" with the action "Create issues and subtasks" with the following configuration:

ticket1.png

There is a checkbox-customfield %{13508} and for every checked option I want to create a seperate subtask. The summary field (%{00000}) from the subtask should be filled with the text "[Checked Value of %{13508}] Summary of Parent Issue". This works very fine with the configuration from the screenshot1 and the result is sreenshot2.

ticket1.png

Unfortunalty it is possible to trigger the transition "action1" for a second, third, ... time. Because of that I want to insert a "Conditional execution". If the subtasks already exists, than the transition shouldn't create a new one for this checked option in customfield %{13508}. For this I want to check, whether there is a subtask with the "checked value from %{13508}" in its summary field (%{00000}). Therefor I filled in this string:

toStringList(%{13508}) none in fieldValue(%{00000}, subtasks())

This works fine, if I create the subtask-summary only with the value from the customfield %{13508}.

ticket1.png

My first problem is: If I execute the transition for the first time with customfield %{13508} checked "value1" and unchecked "value2", the transition creates a subtask for value1. After that I edit the customfield and both values are checked. If I execute the transition for a second time I want the action to create a second subtask for value2 and no further one for value1.

My second problem is: If I use the string "[Checked Value of %{13508}] Summary of Parent Issue" it doesn't work.

ticket1.png

May you help me solving this issue?

Greets Max

Comments (5)

  1. Fidel Castro Armario repo owner

    Hi Maximilian,

    Do the following changes to your current configuration:

    1. Clean parameter "Conditional execution", since it controls the execution of the whole post-function, but we can't use it for a partial execution.

    2. Use the following string list expression to obtain the seed strings:

    filterByPredicate(toStringList(%{13508}), count(filterByPredicate(subtasks(), matches(^%{00000}, "^\\Q" + ^% + "\\E.*"))) = 0)
    

    I love this challenging questions :-). Happy 2017.

  2. Maximilian Peter reporter

    Hi Fidel,

    thanks for your fast reply :-) Wish you a happy 2017!

    Unfortunately the string doesn't resolve both problems. The solution works fine for the first issue, but the second issue already exists.

    My second problem is: If I use the string "[Checked Value of %{13508}] Summary of Parent Issue" it doesn't work. If the summary of the subtask is equal to the checked value (from %{13508}) it works fine, but if the summary of the subtask only contains the checked value (from %{13508}) in it, than it doesn't work.

    Do you have any idea?

    Greets Max

  3. Fidel Castro Armario repo owner

    Sorry, I didn't consider the bracket characters. Use the following seed string expression:

    filterByPredicate(toStringList(%{13508}), count(filterByPredicate(subtasks(), matches(^%{00000}, "^\\Q[" + ^% + "]\\E.*"))) = 0)
    
  4. Log in to comment