Sum up fields in sub-tasks and show the result in story

Issue #369 resolved
Bharath Kumar created an issue

I have a list of sub-tasks let say sub-task 1, sub-task 2 and sub-task 3, now I have fields design and build on all the sub-tasks. Now I enter 1 for design and 2 for build on all the sub-tasks, I should see the result of 3 for the design field in the story and 6 for build field. How can this be achieved, is there an add-on to get pass this issue?

Below is an example of what I am trying to explain

Story        
    Field 1 = 1+5+3      
    Field 2 = 3+6+4

Sub-Task 1 Sub-task 2 Sub-task 3

Field 1 = "1" Field 1 = "5" Field 1 = "3" Field 2 = "3" Field 2 = "6" Field 2 = "4"

Comments (20)

  1. Bharath Kumar reporter

    That was really an awesome explanation thank you so much for taking so much time in implementing that and explaining me, but I implemented the same steps that you said and the target field (i mean the Parent X field will not show any value in it)

  2. Fidel Castro Armario repo owner

    Are you editing the field through the screen in "Edit special fields" transition?

    Please, attach a screenshot of the post-function's tab of "Edit special fields" transition.

  3. Bharath Kumar reporter

    SS1.jpg

    PFA the post function that I am using, and no I am not editing the fields from transition screen, I am entering the values for all the fields at the subtask level and waiting to see them update at the story level

  4. Fidel Castro Armario repo owner

    Firstly, you should use field code %{00041} as argument of subtask() function. That field code is for field "Parent's issue key", but you have mistakenly inserted different field code (the one for Sprint custom field).

    Secondly, you should also insert the post-function in "Create Issue" transition for those fields to be synchronized which are also in create screen. Always insert your post-functions after "Creates the issue originally" post-function.

    Take into account that parent issue's field is updated only when the post-function is executed.

  5. Bharath Kumar reporter

    Thanks again for the prompt reply Fidel, So correct me if I am wrong both the post functions should be on the subtask workflow itself am I correct :)

  6. Fidel Castro Armario repo owner

    Hi Bharath,

    After watching your video showing the failure I can give you the changes you have to do in order to make it work:

    1. You have to select "Parent's Design - Story" in parameter target field, instead of "Design - Story". You have to do it in both post-functions (the one at "Create Issue" and the one at "Edit special fields").

    2. You have to associate "Synchronized Fields" screen to "Edit special fields" transition. You have to edit the transition to do it. Sorry, I forgot to mention it in my instructions.

    With those two changes it will work.

  7. Bharath Kumar reporter

    That works perfectly fine and I am really happy now Fidel " Many many thanks to you " I will have a demo of this feature today and will soon have the purchase made on the marketplace

    Cheers Bharath Kumar

  8. Fidel Castro Armario repo owner

    Hi Bharath,

    I answer your question:

    "One more small addition to the task, now that I have all the synchronized fields summed up on the parent issue I would also like to show the total value of the synchronized fields( meaning sum of all the synchronized fields on the parent issue) is that possible."

    You should add to "Create Issue" and "Edit special fields" transitions a instance of "Mathematical and date-time expression calculator" with the following configuration:

    • Target field: Parent's Sum of special fields (I'm assuming it's a numeric custom field you have created for storing the sum of synchronized fields).
    • Formula: enter a formula built with each formula used for updating each synchronized field separated by operator '+'. Example:
    sum(fieldValue({aaaaa}, subtasks(%{00041}))) + sum(fieldValue({bbbbb}, subtasks(%{00041}))) + sum(fieldValue({ccccc}, subtasks(%{00041})))
    

    assuming that aaaaa, bbbbb and ccccc are field codes for each synchronized custom field.

  9. Fidel Castro Armario repo owner

    Hi Bharath,

    In your video I can see 2 screens associated with "T Size" field, and according to the names it seemed that one of them is Edit screen. Maybe those names don't correspond with their actual functionality.

    Anyway, I already know which is the problem. You forgot a '+' operator between 2 sub-formulas. And, if you read carefully the configuration screen, you will see that the parser is informing you that there is a parsing error. The formula you should use is:

    sum(fieldValue({10500}, subtasks(%{00041}))) + sum(fieldValue({10501}, subtasks(%{00041}))) + sum(fieldValue({10502}, subtasks(%{00041}))) + sum(fieldValue({10503}, subtasks(%{00041}))) + sum(fieldValue({10504}, subtasks(%{00041}))) + sum(fieldValue({10505}, subtasks(%{00041}))) + sum(fieldValue({10506}, subtasks(%{00041}))) + sum(fieldValue({10507}, subtasks(%{00041}))) + sum(fieldValue({10508}, subtasks(%{00041})))
    

    Please, let me know if it solves the problem.

  10. Bharath Kumar reporter

    Ya that works perfectly fine for me, sorry I was busy doing other work so could not respond to your message, you are a great man thanks for all the help.

  11. Log in to comment