Allowing create sub-task only for a specific issue type

Issue #79 resolved
Former user created an issue

Hi. I would like knowing how to manipulate with sub-task creation depending upon the parent issue type. For instance, I've got two issues created with the Bug and Task issue types respectively. I want to allow sub-task creation only for the issues of the Task type and forbid to create sub-tasks for the issues of the Bug type. Could, plz, help me?

Comments (11)

  1. Fidel Castro Armario repo owner

    Hi,

    I suppose that you have one issue task called "Sub-task" and you want to restrict its creation only to "Task" parent issue types. In that case you have to add validator Boolean condition with math, date-time or text-string terms to transition "Create Issue" of the workflow used by "Sub-task", with the following configuration:

    conf-1.png

    Notice that:

    • %{00014} is field code for Issue type
    • %{00040} is field code for Parent's issue type
    • Logical connective IMPLIES is available since version 2.1.22. If you have installed a previous version, you can use the following equivalent expression: %{00014} != "Sub-task" OR %{00040} = "Task"

    Once configured, transition Create Issue will look like this:

    conf-2.png

  2. Fidel Castro Armario repo owner

    Other useful boolean expressions for validations of the same kind:

    1. Avoid any type of subtask creation only to parent issue types "Bug" and "Enhancement":

    %{00041} = null IMPLIES %{00040} not in ["Bug", "Enhancement"]

    being %{00041} field code for field Parent's issue key

    an equivalent expression without using connective IMPLIES and operator NOT IN:

    %{00041} != null OR %{00040} != "Bug" AND %{00040} != "Enhancement"

    2. Avoid "Sub-task" type creation only to parent issue types "Bug" and "Enhancement":

    %{00014} = "Sub-task" IMPLIES %{00040} not in ["Bug", "Enhancement"]

    or an equivalent expression without using connective IMPLIES and operator NOT IN:

    %{00041} != "Sub-task" OR %{00040} != "Bug" AND %{00040} != "Enhancement"

    3. Limit "Sub-task" type creation only to parent issue type "Task", and "Agile Sub-task" type creation only to parent issue types "Story" and "Epic":

    (%{00014} = "Sub-task" IMPLIES %{00040} in ["Task"]) AND (%{00014} = "Agile Sub-task" IMPLIES %{00040} in ["Story", "Epic"])

    or an equivalent expression without using connective IMPLIES and operator IN:

    (%{00014} != "Sub-task" OR %{00040} = "Task") AND (%{00014} != "Agile Sub-task" OR %{00040} = "Epic" OR %{00040} = "Story")

  3. jhili

    Hi, How are you getting the subtask issue code and the parent issue code? Do you mean this is the id you are getting for the issuetype from the issue type table from the DB? Thank you.

  4. Fidel Castro Armario repo owner

    Hi Pradyot,

    %{00014} and %{00040} are codes (i.e., IDs) that JIRA Workflow Toolbox use for representing virtual fields. These virtual fields are implemented by the plugin, and can be used in any boolean expression.

    In particular:

    • %{00014} is field code for "Issue type", and contains the name of the issue type of current issue.
    • %{00040} is field code for "Parent's issue type", and contains the name of the issue type of the parent of current issue.

    As those two virtual fields return names of issue types, you should use literal strings with names of issue types for doing the comparisons.

    In the examples above "Sub-task", "Task", "Agile Sub-task", "Epic" and "Story" are names of issue types.

    In case you rename your issue types, you should also edit the boolean expressions, otherwise they will not work correctly.

    Please, let me know if you keep having doubts.

    Fidel

  5. jhili

    Hi Fidel,

    Thanks for such quick reply. Still I don't get you. I use Jira Version 6.3 . Will %{00014} and %{00040} ID same for me too? I don't see any workflow Toolbox in my Jira. When I try to add the Validators at 'Create' transition of sub task type issue type workflow I see the screen (Please check the attached screen shot).

    Your reply is greatly appreciated.

    Thank you, PradyotAdd Parameter to Validator.PNG

    AddValidatorScreen.PNG

  6. jhili

    Hi Fidel,

    But, without having that plug in, I see the option of add the Boolean Expression (if you check the second screen shot in my prev comment). Then in the first screen shot you can see, where we can add the boolean expression.

    Isn't it the same thing to achieve the goal?

    Thank you, Pradyot

  7. Fidel Castro Armario repo owner

    Pradyot,

    I think that feature is provided by Workflow Enhancer plugin, which uses another syntax, and is much less powerful than JIRA Workflow Toolbox.

    I can't tell you whether you can implement this use case with that plugin or not. You should contact its vendor for more details.

    Regards,

    Fidel

  8. Log in to comment