Question for post function "Create Issues and Subtasks"

Issue #585 resolved
Christof Hurst created an issue

Hi, I want to create a subtask within a transition. But I only want to create it once. So I checked the option "Save issue keys of created issues into Ephemeral String 3 virtual field as a comma separated list." and made a condition %{00063} = "" But the subtask are created multiple. What did I wrong? Best regards Christof

Comments (12)

  1. Fidel Castro Armario repo owner

    Hi Christof,

    Ephemeral fields are intended to store values only within a same transition. These fields are automatically cleaned at the end of each transition. For that reason you can't use them in order to prevent creating an certain issue in a second or subsequent executions of a same transition.

    In order to prevent issue creation in a second or subsequent executions of a same transition you should use a boolean expression that specifically checks for the existence of the created issue. Please, attach a screenshot with the configuration of your post-function, and I will give you a boolean expression for the parameter Conditional execution that will do the work.

  2. Christof Hurst Account Deactivated reporter

    Hi Fidel, thank you so much for your help. Use case is that i want to create a subtask as a copy just once the tranistion is made. Later I want to change subject and description. I think same boolean expression will fit. Best regards Christof

  3. Fidel Castro Armario repo owner

    Hi Christof,

    One question: Are those two "Write field on linked issues or subtasks" post-functions inserted in the same transition as "Create issues and subtasks"?

    In affirmative case, you can simply compose those text for Summary and Description in the "Create issues and subtasks" post-function itself. You don't need to use 2 additional post-functions to do it.

    You can use the following boolean expression in parameter Conditional execution:

    count(filterByIssueType(subtasks(), "Sub Task")) = 0
    

    I'm assuming that you only allow a Sub Task for the parent issue, created either by post-function or manually. If that's not the case, please tell me:

    1. Do you allow only one Sub Task created by the post-function for each parent issue, or more than one?
    2. In case you allow more than one, how do you differentiate each Sub Task in a same parent?
    3. The provided solution allows to create Sub Tasks manually after the one created by the post-function, but not before, since a manually created Sub Task would block the creation by post-function. Is this Ok for you?
  4. Christof Hurst Account Deactivated reporter

    Hi, the other two manipulations are in another transition. I can not give garantee that only one subtask exists. But only one should be made via post function. Perhaps we have to store generated sub task key into hidden field.

  5. Fidel Castro Armario repo owner

    Hi @christofhurst,

    Let's use a hidden Text field called Auto-Created Issue where we store the value of Ephemeral string 3. To do it add "Copy a parsed text to a field" post-function after "Create issues and subtasks" with the following configuration:

    • Target field: Auto-Created Issue
    • Parsing mode: basic
    • Text to be parsed...: %{00063}

    where %{00063 is field code for Ephemeral string 3.

    Then use the following boolean expression for Conditional execution parameter:

    %{nnnnn} = null
    

    replacing nnnnn with field code for Auto-Created Issue custom field.

  6. Christof Hurst Account Deactivated reporter

    Hi @fcarmario, thank you cery much. Single creation works now. But I have to check for auto created issue = null, not != null ;-) But updating the fields doesn't work. I added ^%{Issue key} = %{Auto-Created Issue} (^%{00015} = %{21800}) to filtering by field values. Has this to be done within condition?

  7. Fidel Castro Armario repo owner

    You are right, condition is %{21800} = null.

    Boolean expression at filtering by field values is correct: ^%{00015} = %{21800}. The problem should be the parameter conditional execution.

  8. Christof Hurst Account Deactivated reporter

    Did not work. sub task is not edited. Is there anything else configured wrong?

  9. Fidel Castro Armario repo owner

    Hi @christofhurst,

    I don't see anything wrong in your configuration. Anyway, parameter conditional execution is not necessary at all in post-functions "Write field on linked issues or subtasks". Please, clean that parameter.

    Please, include temporarily field "Auto-Created Issue" into view screen, in order to verify that the field is being correctly set.

    You can also try using "Write field on issues returned by JQL Query or Issue List" post-function with the following JQL query:

    issuekey in (%{21800})
    

    Anyway, if nothing of these works, we can have a screen-share through Skype. I would like to see the problem in direct. My Skype user is fidel100r.

  10. Christof Hurst Account Deactivated reporter

    Thanks for your help. I had to check if Ephemeral String is not null before assigning to Auto-Created Field.

  11. Log in to comment