How to Reset Tshirt Size for an Epic ?

Rita Arellano
Contributor
November 15, 2024

How can I adjust the T-shirt size on an epic after a that is linked to an epic is canceled. 

Example: T-Shirt sizes go as follows: 

XS = 50 hrs or less

S = 51-100 hrs

M = 101-250 hrs

L = 251-500 hrs

XL = 501 hrs or greater

Once a story linked to the epic is canceled - then recalculate the story points and resize the T-Shirt size accordingly. I have the below automation rule. However, no action takes place, under Audit logs "No Actions Performed." Can anyone point me to the right direction? 


 

Trigger: When value changes for: Status

Issue type = story

branch to:  parent

Action Lookup Issues: 

 

"epic link" = {{issue.key}} AND status not in (Canceled) and issuetype = story

AND

Action Create Variable: 

 

variable name = totalStoryPoints and smart value is: {{#=}} {{#foreach(issue in lookupIssues)}} {{issue.fields.storypoints | default(0)}} {{#if(not(last))}}+{{/}} {{/}} {{/}}

AND

Action Create Variable: newTShirtSize
Smart Value: 

{{#if(totalStoryPoints >= 1 and totalStoryPoints <= 50)}}XS{{/}} {{#elseif(totalStoryPoints > 50 and totalStoryPoints <= 100)}}S{{/}} {{#elseif(totalStoryPoints > 100 and totalStoryPoints <= 250)}}M{{/}} {{#elseif(totalStoryPoints > 250 and totalStoryPoints <= 500)}}L{{/}} {{#else}}XL{{/}}

Action: Edit Issue

Field to Edit: TShirt Size

Value: {{newTShirtSize}}

2 answers

1 accepted

2 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.
November 16, 2024

Hi @Rita Arellano 

The syntax you are using for math expressions and for conditional expressions is incorrect: 

Where did you find that syntax described as that source is incorrect?

 

To sum the values from a Lookup Issues action for the Story Points field, you may just sum them directly as the results are a list: https://confluence.atlassian.com/automation/jira-automation-actions-993924834.html#Jiraautomationactions-lookup-issuesLookupissues

For example, to do this with a default value of 0 that would be this:

{{lookupIssues.Story Points.sum|0}}

 

To perform the conditional tests to determine the t-shirt sizing, you may use the and() function in the condition: https://confluence.atlassian.com/automation/jira-smart-values-conditional-logic-1081351607.html#Jirasmartvaluesconditionallogic-and

Also, created variables are text, and so must be converted to numbers for such comparisons: https://confluence.atlassian.com/automation/jira-automation-actions-993924834.html#Jiraautomationactions-create-variableCreatevariable

For example:

{{#if(totalStoryPoints.asNumber.le(50))}}XS{{/}}
{{#if(and(totalStoryPoints.asNumber.gt(50),totalstoryPoints.asNumber.le(100)))}}S{{/}}
{{#if(and(totalStoryPoints.asNumber.gt(100),totalstoryPoints.asNumber.le(250)))}}M{{/}}
{{#if(and(totalStoryPoints.asNumber.gt(250),totalstoryPoints.asNumber.le(500)))}}L{{/}}
{{#if(totalStoryPoints.asNumber.gt(500))}}XL{{/}}

 

Kind regards,
Bill

Rita Arellano
Contributor
November 25, 2024

@Bill Sheboy thanks, I seem to have resolved the issue. 
The issue I was trying to resolve involved ensuring that when a story has a status of 'Canceled,' its story points are subtracted from the total story points of all stories. 

Then adjust the 'T-Shirt' which in our case we use 'Size Estimate' size according to the total remaining story points remaining. 

Please see my approach below, I basically replicated the branching below for each Size Estimate (T-shirt) size: 
Atlassian 1.jpg

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.
November 26, 2024

Thanks for that information, Rita.

I recommend not subtracting for this scenario, and instead adjust your JQL to exclude the Canceled issues and recalculate the sum / t-shirt sizing for the remaining issues.  This will lower the rule complexity and risk of errors.

Rita Arellano
Contributor
November 26, 2024

Sounds good, I will try that. Thanks so much. 

Like Bill Sheboy likes this
0 votes
Salih Tuç
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.
November 16, 2024

Hi @Rita Arellano ,

The logic is correct, however you are failing on the "Lookup Issues" action. The automation is triggering by the "Story" that canceled, but you are trying to use this story as an "Epic Link":

"epic link" = {{issue.key}}

You should go to the Epic Link of the Story directly ({{issue.Epic Link}}) or use a JQL Function like "isEpicOf" instead of {{issue.key}}

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.
November 16, 2024

Hi @Salih Tuç 

The rule Rita showed has a branch to the parent (Epic) to perform the update.  And so the JQL to compare {{issue.key}} to the "Epic Link" is correct.

Kind regards,
Bill

Like Stefan Salzl likes this
Salih Tuç
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.
November 16, 2024

Hi @Bill Sheboy ,

 

You are correct, I missed that line. Thanks for the info✌️

Suggest an answer

Log in or Sign up to answer