Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation - Update Backlog Story Point to sum of all its Subtasks Story Point estimate

Reza April 28, 2022

Hi!

I am searching all over this forum and the net and testing many things for 3 days to solve this challenge! BTW! I am the owner and of course admin of this project.

 


Story:

I want to write an Automation that when one of the subtask STory Point Estimate changed, the sum of all of them add to their parent (backlog) story point. Exactly like the following picture:

 

2022-04-28_19-56-25.png

 

But I get this error message over and over:

  • Unknown fields set during edit, they may be unavailable for the project/type. Check your custom field configuration. Fields ignored -
Story Points (customfield_10028)
  • No fields or field values to edit for issues (could be due to some field values not existing in a given project):
LIB-120

My Script:

My Automation script and its Audit log:

Clipboard11.png

 

Clipboard08.png

As you can see, my following code is working as expected and return the sum of all subtasks Story Point Estimate in debug result (59.0):
{{issue.SubTasks.Story point estimate.sum}}
But when I am using that in this Edit Issue Filed like this, I get that error code:
Clipboard09.png

What did I do:

I encounter this QA here:

https://community.atlassian.com/t5/Jira-Software-questions/How-do-I-set-the-right-permissions-so-Automation-app-user-can-do/qaq-p/1371186

They suggest: 

~~~~~~~~~

Navigate to the Project > Project settings > Permissions > check if the "atlassian-addons-project-access" is added to your project permission, especially in the "Edit issues" permission.

~~~~~~~~

But I do not have any Permission option in my Project Settings, So I search more and find this page:

https://support.atlassian.com/jira-cloud-administration/docs/manage-project-permissions/

Then I found Edit Issue permission in "Default Permission Scheme" and changed add Administrators to it like this:

Clipboard10.png

 

But even after the above changed, still, I get the same error!

 


What did I miss here!!? 

 

Thanks for your time in advance

Reza

3 answers

1 accepted

5 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2022

Hi @Reza -- Welcome to the Atlassian Community!

Ignoring for a moment assigning story points to subtasks...

You appear to be using a Team-managed project, which uses the Story point estimate field, yet your rule action for editing the parent is trying to set Story points.  The Story points field is used for Company-managed projects.

I recall that the Story point estimate field is not currently listed for the edit action's dropdown of fields, so instead you will need to use an advanced edit with JSON: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

Kind regards,
Bill

Reza April 28, 2022

Hi @[deleted] 

Thanks so much for your suggestion. I removed all smart values from the simple field then tried these combinations in the advance box:

 

NOTE: Total is a variable that I store this smart value in it and test it in Debug to make sure it returns the right value too:

{{issue.SubTasks.Story point estimate.sum.round}}

 

 

{
  "fields": {
    "customfield_10028": {
      "value": {{Total}}
    }
  }
}

Same error message

 

{
  "fields": {
    "customfield_10028": {
      "value": {{issue.SubTasks.Story point estimate.sum.round}}
    }
  }
}

Same error message

 

{
  "fields": {
    "customfield_10028": {{Total}}
  }
}

Same error message

 

{
  "fields": {
    "customfield_10028": {{issue.SubTasks.Story point estimate.sum.round}}
  }
}

Same error message

 

{
  "fields": {
    "cStory Poitns": {{Total}}
  }
}
Error message: 

Additional fields contains invalid field(s) in 'update' or 'fields' section.
Story Points
 

Best Regards

Reza

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2022

Please try this for your JSON, assuming the branch is on the parent issue:

{
"fields": {
"Story point estimate": {{issue.subtasks.Story point estimate.sum|0}}
}
}

Also please note that smart values are case and spacing sensitive, and the rule editor shows almost no errors when we enter these incorrectly.  Instead it just treats them as null. 

Like # people like this
Reza April 28, 2022

WooooooooooooooooooW!!!! Finally! after 3 days!! lool
Thanks so much... It is working very well! 


Before your suggestion, since I had another Project, I made that automation global, and now it is almost perfectly working on both of those projects. But while it is changing the parent Story Point with the sum of all subtasks correctly, still I get this warning for both Projects:

 

* Issues edited successfully
LIB-120

* Unknown fields set during edit, they may be unavailable for the project/type. Check your custom field configuration. Fields ignored -
Story Points (customfield_10028)


Why is that!?

Reza April 28, 2022

And why we should set the value of calculation into "Story point estimate" and Not "Story Points" !?

Since our goal was to change the parent "Story Points" filed and was not the subtasks "Story point estimate" !?

Is it Backlog filed variable name for its "Story Points" Textbox actually is "Story point estimate"!?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2022

I suggest looking at the project types, as it appears to be referencing the Story points field somewhere in the rule when the project type for the triggering issue is Team-managed...which only uses Story point estimate.

For whatever reason...when Team-managed (formerly called NextGen) projects were added they needed to create a new story point field, called Story point estimate, but in the UX they kept the name the same as "Story points" to avoid confusion.  The specific field name is only relevant for JQL, REST API, and automation users.  I suspect at some point in the future these will consolidate to one field with a single name...but who knows; I'm just a customer.  :^)

 

Two more things to help...

When you are are unsure of the correct smart value/field name to use in a rule, please try the information in this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Next, you note making this rule global scope.  What is your Jira Cloud license level?  Different levels have different limits on the number of global/multi-project rules than can run each month: https://support.atlassian.com/jira-cloud-administration/docs/explore-jira-cloud-plans/  Please discuss this with your site admin to prevent running out of capacity for your rules.

Like Reza likes this
Reza April 28, 2022

Thanks again, not only for solving the challenge but for all the extra info.

Cheers & Happy Codding 

1 vote
Garrett McCreery
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 28, 2022

If the static value method as @Mark Segal has mentioned works, then try to update your smart value like this:

{{issue.SubTasks.Story point estimate.sum.asNumber}}

 It maybe that it's looking for a number and not text?

Reza April 28, 2022

@Garrett McCreery 

Thanks for your suggestion. I actually use your smart value too and store it in a variable and try the script again, but failed!

1 vote
Mark Segall
Community Champion
April 28, 2022

Hi @Reza and welcome to the community!

Can you try a test where you set the parent's story point field to a static value (e.g. 5) just to see if that works?

If that works, you may want to capture the calculation in a variable and then apply the variable to the edit issue function.

If it doesn't work, there is definitely something still off in the overall config. Perhaps the field configuration or some weird properties applied to the workflow

Mark Segall
Community Champion
April 28, 2022

Another possibility is that your log is showing a decimal and story point is a whole number.  You could try adding the round function to ensure it comes across as a whole number.

{{issue.SubTasks.Story point estimate.sum.round}}
Reza April 28, 2022

@Mark Segall Thanks so much for your fast reply. Since I am a beginner it takes a while to search for how to and test your suggestions and other friends.

 


Can you try a test where you set the parent's story point field to a static value (e.g. 5) just to see if that works?

No luck!

I changed parent Story Point and nothing happen (my trigger only set for "Story point estimate") then I changed one of the children's "Story point estimates" and the script run with the failed result again.

 


If that works, you may want to capture the calculation in a variable and then apply the variable to the edit issue function.

No luck!

While the previous suggestion didn't work, I created a variable and test that too. again failed!

 


If it doesn't work, there is definitely something still off in the overall config. Perhaps the field configuration or some weird properties applied to the workflow

Partially checked! No Luck

Actually, I add some new labels in Workflow, so I went there and remove them all and tested again and again failed!

 


{{issue.SubTasks.Story point estimate.sum.round}}

Used this trick too and even store it in a variable, but no luck!

 

Thank you so much for your time and suggestions. 

Mark Segall
Community Champion
April 28, 2022

Take a look at @Bill Sheboy's response.  I think he hit the nail on the head.

Like # people like this

Suggest an answer

Log in or Sign up to answer