Forums

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

Help with code to split points based on number of tasks

Brian Baldwin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 28, 2024

Our team only points stories, but not tasks. Although not perfect, I'd like to create automation to figure out the number of stories marked with a certain component (we use Dev, Config, and QA) and assign a portion of the points based on the number of tasks.

So if there are 4 config tasks on a story and 2 points of Config work (we track that in a custom field), then it would assign each task .5 points.

I was heading down the path of creating a custom variable called ConfigTaskTotal that counts the number of tasks with a component of config, but then once I get there, I can't figure out how to use it to divide the field that holds config points by that number.  Hoping to just do it simply within a smart field like this, but it doesn't work.

 

{{#=}}{{issue.customfield_10879/ConfigTaskTotal}}{{/}}

 

Any pointers would be greatly appreciated!

1 answer

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2024

Hello @Brian Baldwin 

Welcome to the Atlassian community.

Have you tried using the "divide" function?

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/#Divide

If that doesn't solve the problem please provide us with screen images that show the entire automation rule and the details of each step. Also, please show us the Audit Log for the rule execution. Tell us what result you are actually getting if it doesn't match your expectations. That will enable us to help you debug the rule.

Additionally, look into using the Log Action to print in the Audit Log values for fields and smart values that your are trying to use/modify to confirm that the values are what you expect them to be.

Brian Baldwin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 28, 2024

Hey Trudy,

Thanks for the reply, the funny thing is that I had tried it on Friday and it wasn't working, but copied and pasted my text from Friday today and Voila!

{{issue.parent.customfield_10797.divide(DevTaskTotal)}}

 

Not perfect but directionally accurate that it counts the number of subtasks with a component marker and uses that to allocate a slice of the points for the story to that task.

 

Query for the lookup in case someone is trying to do the same thing

issuetype = sub-task and component in (Development) and parent in ({{issue.parent.key}})

 

Then use lookupfilter.size to store it in the DevTaskTotal Variable

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events