Send e-mail to the next sub-task assignee, if the subtask before goes in Status 'done'

Issue #321 resolved
Seher Sönmezsoy created an issue

I want to send a notification mail to the assignee of the next subtask, if the assignee is an other user in the next subtask. The condition for that is, the subtask of the subtask before should go in status done. For example

Subtask 1 User 1 Done Subtask 2 User 1 Done --> Notification mail to user 2 Subtask 3 User 2 To Do

Is that possible?

The second issue is to enable closing (status done) only a task, if all subtasks are in status 'done'. After the status done of the last subtask, the task assignee should get a notification mail.

By opening the subtask again, the task should go in status 'to do'.

I know, this are two questions. There are relations between of them.

Best regards

Seher

Comments (10)

  1. Fidel Castro Armario repo owner

    Hi Seher,

    All those use cases can be implemented using JIRA Workflow Toolbox.

    ###USE CASE 1 - Notification by Mail to the assignee of the Next Subtask:###

    We have to insert the following two post-functions in Close Issue transition in subtask's workflow.

    1) Use "Copy a parsed text to a field" post-function with the following configuration:

    Captura de pantalla 2017-03-06 a las 20.24.03.png

    Text to be parsed is:

    first(fieldValue(%{00003}, nthElement(subtasks(%{00041}), indexOf(%{00015}, subtasks(%{00041})) + 1))) 
    

    This post-function populates Ephemeral string 1 with the assignee of the next subtask, or null is current subtask is the last one.

    Note that:

    • %{00003} is field code for Assignee
    • %{00015} is field code for Issue key
    • %{00041} is field code for Parent's issue key

    2) Use "Send an email" post-function with the following configuration:

    send-email-conf-1.png send-email-conf-2.png

    Parameter conditional execution is:

    %{00061} != null AND %{00061} != %{00020}
    

    Note that:

    • %{00061} is field code for Ephemeral string 1
    • %{00020} is field code for Current user

    Once configured, Close Issue transition in subtask's workflow will look like this: transition-configuration.png

  2. Fidel Castro Armario repo owner

    ###USE CASE 3 - When last Subtask is closed (status Done), Task's assignee should get a notification by mail###

    Add Send an email post-function to Close Issue transition of Subtask's workflow with the following configuration:

    send-email-1.png send-email-2.png

    Parameter Conditional execution is:

    count(filterByStatus(siblingSubtasks(), "Done")) = count(siblingSubtasks())
    
  3. Seher Sönmezsoy reporter

    Hi Fidel,

    nice it works. But can we define a condition for the subtasks? I want to set my subtask to status done, only if my subtask before is in status done. So I want to follow the order. At first subtask 1 then subtask 2 then 3 and so on. I'm now allowed to close subtask 4, before the first three are closed. This condition should exist for all my subtasks in sequence.

    Thank you for your help.

    Best regards,

    Seher

  4. Fidel Castro Armario repo owner

    ###USE CASE 5 - Prevent Subtasks from closing (status Done) while there are previous Subtasks not yet closed (status different from Done)###

    Add "Boolean condition/validator with math, date-time or text-string terms" condition or validator to Close Issue transition in Subtask's workflow with the following boolean expression:

    count(filterByPredicate(siblingSubtasks(), indexOf(^%{00015}, subtasks(%{00041})) < indexOf(%{00015}, subtasks(%{00041})) AND ^%{00016} != "Done")) = 0
    

    Note that:

    • %{00015} is field code for Issue key
    • %{00041} is field code for Parent's issue key
    • %{00016} is field code for Issue status

    You can implement this restriction as a condition or as a validator. I recommend the second one, because you can show the uses a custom message explaining the cause that prevents him from closing the subtask.

  5. Seher Sönmezsoy reporter

    Hello Fidel,

    thank you for all your help. It helps me reallly to understand the workflow and how much functionalities can be implemented with the workflow box.

    Best regards,

    Seher

  6. Log in to comment