Notify watchers of parent when subtask is created in it.

Issue #186 resolved
Raju Adluru created an issue

Hi Fidel I need your help on how to setup this with your plugin. Parent issue watchers needs notification when new defect sub task created for the parent.

JIRA v 6.3.12 thanks for your help and support. Raj

Comments (14)

  1. Fidel Castro Armario repo owner

    Hi Raj,

    A pair of questions:

    1. How many statuses has parent's workflow?
    2. In how many different statuses can be parent issue when subtasks are created?
  2. Raju Adluru reporter

    Fidel 1.There are 10 statuses for parent issue. 2.parent can be in 4 or 5 statuses, when sub tasks are created.

  3. Fidel Castro Armario repo owner

    A very simple solution would be to add parent's watchers also as watchers of its subtasks.

    To implement this solution you simply have to add post-function "Copy a parsed text to a field" to "Create Issue" transition in subtasks's workflow using the following configuration:

    conf-0.png

    Note that:

    • %{00134} is field code for "Parent's watchers".

    Once configured, transition "Create Issue" in subtask's workflow will look like this:

    conf-1.png

    This solution also works if parent issue and subtasks share the same workflow.

    There is also a more complicated solution that only notifies subtasks creation. That solution implies creation of several hidden reflexive transitions in parent's workflow.

    If you want to consider the more complicated solution, I will explain it in detail.

  4. Raju Adluru reporter

    Fidel Thanks for simple solution for this, but all those watchers will get updates on subtasks also. Can it work for clone and copied issues also? i use listener script for clone and copy, in that i want to use above simple solution to get watchers from original issue. Can you please send me other option also. Thanks much. Raj

  5. Fidel Castro Armario repo owner

    Hi Raj,

    I explain you, step by step, how to implement a notification of subtasks creation to parent's watchers:

    1) You have to add a reflexive transition called "Remove Parent Watchers" to first status (i.e., to the destination status of "Create Issue" transition) in subtask's workflow. A reflexive transition is a transition with a same status as origin and destination. It doesn't matter whether you share the same workflow for parent issues and subtasks. Once the reflexive transition has been added, your workflow will look similar to this: workflow.png

    2) Add condition "Transition is triggered by JIRA Workflow Toolbox post-function" to transition "Remove Parent Watchers". This condition will hide the transition to JIRA users, leaving it available only to workflow post-functions:

    remove-parent-watchers-conditions.png

    3) Add post-function "Add or remove watchers" to transition "Remove Parent Watchers" using the following configuration:

    remove-parent-watchers.png

    Once configured, transition "Remove Parent Watchers" will look like this:

    remove-parent-watchers-post-functions.png

    4) Add post-function "Add or remove watchers" to transition "Create Issue" using the following configuration:

    add-parents-watchers.png

    5) Add post-function "Copy a parsed text to a field" to transition "Create Issue" using the following configuration:

    remove-parent-watchers-delayed-execution.png

    Once configured, transition "Create Issue" will look like this:

    create-issue-postfunctions.png

    This solution adds temporarily parent issue's watchers to new subtask, and automatically remove them once they have been notified.

  6. Raju Adluru reporter

    Hi Fidel Can this work for clone and copied issues also? I am using Jamie's script listener for clone and copy when status changes, in that i want to user your post function to get watchers from original issue. I added post function in create issue. I tried your post functions ( "text parsed in basic mode" and "Add watchers users in field") but still i am not getting watchers copied from original issue to cloned issue. Appreciate your help.

  7. Fidel Castro Armario repo owner

    Hi Raj,

    Do you mean "Clones an issue and links." listener of "Script Runner"?

  8. Fidel Castro Armario repo owner

    Raj, I have tried some listeners and it seems to work correctly. Can you please attach a screenshot with your listener's configuration?

    Which version of Script Runner are you using?

  9. Log in to comment