Can we subtract the values from the overall Sizing story when the sub-task is cancelled?

Issue #647 resolved
Dinesh Loyapalli created an issue

In sizing sub-task we have some Numeric custom fields and these fields from all sub-tasks are being rolled up and added at the sizing story level.Now when we say that the sizing sub-task is status is cancelled then can we able to subtract the values from overall sizing story?

Sizing Sub-Task1 Screenshot:-Sub-Task1.PNG

Sizing Sub-Task2 Screenshot:-Sub-Task2.PNG

Overall Sizing at the Sizing Story level:- SizingValues at the parent level.PNG

The status of the Sizing-Sub task is automatically cancelled if we remove the component at the epic level.

Comments (20)

  1. Fidel Castro Armario repo owner

    Hi @DineshLoyapalli,

    Are they normal number custom fields? Please, attach a screenshot of the post-functions you are using for setting those fields.

  2. Dinesh Loyapalli reporter

    They are normal Number Custom Fields.We are just using a Global reflexive transition and we have attached a screen for setting these fields in this transition Post functions at sizing sub-task level.PNG Post function for rolling up the values at the sub-task level and adding them up at the Sizing story level.

  3. Fidel Castro Armario repo owner

    I think that the best way to do it is to replace all the total number custom fields in Sizing Story with Calculated Number Field, available in recent versions of JIRA Workflow Toolbox.

    You should use following formulas for the calculated fields:

    sum(fieldValue({nnnnn}, subtasks()))
    

    replacing nnnnn with the field code of the field you want to sum up.

    This way you can also remove the global reflexive transition, since the values of the fields will be automatically updated, and include the fields in the normal EDIT screen of JIRA.

    You should also use a Calculated Number Field for field EGS Effort.

  4. Dinesh Loyapalli reporter

    we are using global reflexive transitions at the sub-task level just to enter the values in the custom fields at the sub-task level.We are using this because after certain status we are disabling the transition so that these initial fields in the Sizing sub-task are no longer editable.

    Now when we cancel the sizing sub-task the values from that particular sub-task should be subtracted from the overall sizing i.e at the sizing story level.

  5. Dinesh Loyapalli reporter

    Hi Fidel,

    Is there any option to change the Data type of the Custom Fields or do i have to delete and re-create them again? Can you please help me with this?

  6. Fidel Castro Armario repo owner

    Hi @DineshLoyapalli,

    Sorry for the delay in my response. I missed your comments in the issue.

    Try replacing term subtasks(%{00041}) in your formulas for setting parent's fields with this one: filterByPredicate(subtasks(%{00041}), ^%{00016} not in ["Cancelled"]).

    Where %{00041} is field code for Parent's issue key, and %{00016} is field code for Issue status.

    You should to write the name of Cancelled status exactly, i.e., respecting the case. You can check up the name of the status at Administration > Issues > Statuses. I warn you that JIRA UI usually shows status in uppercase.

  7. Dinesh Loyapalli reporter

    So now i don't have to change the Custom Fields in the Sizing story to " Calculated Number Field"?

  8. Dinesh Loyapalli reporter

    But for some Sub-tasks the sizing details are already entered and these values are rolled up and added to the sizing story level and now if we cancel the Sizing Sub-task it should subtract the values that we have provided for this particular sub-task from the overall Sizing.

  9. Fidel Castro Armario repo owner

    Keep the custom fields as normal number fields. Then change all the formulas in "Mathematical and date-time expression calculator" post-functions at your global reflexive transition replacing term subtasks(%{00041}) with filterByPredicate(subtasks(%{00041}), ^%{00016} not in ["Cancelled"]).

    After that changes, each time you the transition is executed, the values of parent issue will be recalculated only with the values of non-cancelled sub-tasks.

  10. Dinesh Loyapalli reporter

    Its not working...Its not subtracting the already added values from the overall sizing at the Sizing story level whenever the status of the Sizing sub-task is cancelled.Its just displaying the same added values even though the status is cancelled.

    The status of the Sizing-Sub task is automatically cancelled if we remove the component at the epic level.We have implemented this logic in our previous conversation.

    The changes that i have made in the sub-task post functions:-Su-Task Post Functions.PNG

    Thanks...

  11. Dinesh Loyapalli reporter

    This logic is implemented at the Sub-task level..Once sub-task is cancelled its not going to execute any transition again know.May be that is the reason why its not subtracting the values.Can this logic be implemented at the Sizing Story Level?

  12. Fidel Castro Armario repo owner

    Try adding "Copy a parsed text to a field" post-function into transition to Cancelled status in sub-task's workflow with the following configuration:

    • Target field: Execute transition (delayed execution)
    • Parsing mode: basic
    • Text to be parsed...: the name of the global reflexive transition

    This way the global reflexive transition will be executed automatically after a sub-task is cancelled.

  13. Dinesh Loyapalli reporter

    Text to be parsed...: the name of the global reflexive transition

    Can I add multiple transitions to it?

    Because the values are being rolled up to the story level at two different transitions in the Sizing Sub-task level.

    Transitions: 1>Finish Initial Sizing 2>Finish Final Sizing

  14. Dinesh Loyapalli reporter

    Its not Working....Values are not being updated at the Story level. Here is the Screenshot of the post function that i have added:- Cacel-Sizing Post Function.PNG

  15. Fidel Castro Armario repo owner

    Hi @DineshLoyapalli,

    "Finish Initial Sizing" is not a global reflexive transition, and thus is not available at Cancelled status.

    Please do the following:

    1. Create a reflexive transition at Cancelled status, i.e., a transition which has Cancelled as origin and destination status. Let's call it "Update Sizing Story".
    2. Add "Update Sizing Story" all the post-functions you have in "Finish Initial Sizing" and in "Finish Final Sizing" for updating fields in Sizing Story. Don't forget to use the term filterByPredicate(subtasks(%{00041}), ^%{00016} not in ["Cancelled"]).
    3. Use "Update Sizing Story" in "Text to be parsed.." as the name of the transition to be executed in "Copy a parsed text to a field" post-function.
  16. Log in to comment