Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,499,066
Community Members
 
Community Events
179
Community Groups

Can Automation for JIRA calculate a field on a linked issue using math functions as action?

I am currently working on the challenge to implement project controlling in JIRA and was wondering whether a field on an issue called project could automatically be calculated when a value on a linked sub-project issue changes?

I have a hierarchy over four levels using sub-tasks already so changing the link between project and sub-project to a task-sub-task-relationship is not an option.

5 answers

1 accepted

1 vote
Answer accepted
andreas Rising Star Aug 23, 2017

Hi Nadine, 

I'm not 100% sure I fully understand your exact setup, but with Automation for JIRA, you can action related issues that you find based on JQL. Match functions can be applied to those.

 

So for example you could have a rule like this:

  • Trigger: Field value changed with your field selected
  • JQL condition: type = sub-task ?  
  • Branch rule with Parent
    • Edit issue action where you set the 'project' field to something like:
      {{#=}}{{triggerIssue.someField}} + 25{{/}}

'triggerIssue' would refer to the issue produced by the trigger in this example. 'someField' is the name of your field.

Not sure if this helps.  Like I said I need more details about your exact case.    Bacially in the branch rule, you could also use JQL to find the related issue somehow.  

Cheers,

  Andreas

Hello Andreas 

Thanks a lot for your prompt reply.

Actually, I'm not sure I fully understand my setup... ;-) but let me try to explain: 

I have a standard issue type project linked to 1-n other standard issue types sub-project via the link has sub-project.  Both issue types have a numeric field called Labour Hours and what I need to achieve is the Labour Hours for issue project being automatically updated as sum of Labours Hours of all linked sub-projects when Labour Hours of one sub-project is updated. 

I have already configured a prototype using tranistion triggers and post-functions for calculations which works fine. But now my customers wants values to be updated not using transitions. We could use Script Runner or a custom add-on to achieve this but I prefer a solution not requring to much scripting which is also maintained as a marketplace add-on. Hence, I would love to use Automation for JIRA.

andreas Rising Star Aug 23, 2017

Hi Nadine,

Ah right so you want to calculate the aggregate sum of various linked issues.  We don't support this yet, but we're already tracking this request at https://codebarrel.atlassian.net/browse/AUT-476.

We've got quite a few higher priority items in our backlog at the moment so it will be a while before we can get to this, but we'll let you know when we get a chance to work on this.

Cheers,

  Andreas

Hi

We have the same scenario that we'd like to address.

Our hierarchy of issues is made of Epics / Stories / Subtasks.

We'd like to have a "Rolled Up Time Spent" custom field that sums up the time spent on a issue with the total time spent on related issues below when time is logged against either the task itself or its related issues.

e.g. when time is logged on a subtask (or the subtask is edited), "Rolled Up Time Spent" is updated at the parent Issue & the Epic levels (may be a cascade of 2 automations here, due to the 3 levels hierarchy).

I don't seem to be able to login and vote for AUT-476, so I add this comment here to say that I am interested ;-)

Thanks

Hi

We are currently evaluating Automation for JIRA for our needs.  This is a very important feature for us as well, especially now that the JIRA pricing structure has changed significantly.  We will need  to minimize the number of add-ons we purchase.  I'm not sure if there is way to vote up on this but consider this as high priority if you can.

Thanks.

This is for people who find this in the future. I was able to set up a Jira Automation to calculate a value.

Trigger: Montior field values for changes.

Then I created Variables using Smart Values for each of the custom fields I created.

smart.png

Once I had all of the variables defined, the final automation component was an Edit Issue field. I had set up a custom view only field so that it couldn't be edited directly by users. I used Andreas formula in the accepted comment which worked perfect for me. 

{{#=}}({{Reach}} * {{Impact}} * {{Confidence}}) / {{Effort}}{{/}}

final.png 

Very nice, I really wish they'd port over all these nice functions to the server/data center versions :(

hi , can i use automation and make formula with custom field? if i can..could you please help me?

Yes it’s possible. See my previous reply in this thread for more info.

Like mahi kamal likes this

thank you for explain..but i have problem could you please help me?sx 1_23_2023 10_05_52 AM.png

I think it's because you're using an If/Else statement, but it doesn't contain an action when the first If matches. 

You're basically saying:

IF custom_field_11225 is not empty

          THEN do nothing <-- This is what is causing the issue

IF custom_field_11226 is not empty

          THEN edit issue fields

 

If the first IF statement does not have an action and all you're doing is checking if that field isn't empty before the next IF statement, consider using an Issue fields condition instead.

2023-01-23_19-14-20.png

Like mahi kamal likes this

thanks a lot my friend you good explained to me.

now i have another question if you can answer me i really appreciate

i want calculate to formula this 100-(responsetime - ticket count * 360 / 60 * 5 ) and i want write in custom field so i write smart value like this =>

  {{#=}}100-{{issue.customfield_1112}}-{{issue.customfield_1113}}*360/60*5{{/}} 

and have error could you please help me about this again? thank you so much

 i want calculate the formula and whats the type of custom field  when calculate formula?

@Patrick Haley  I want to calculate custom fieild by 

I want to make an automation rule like below.

when : issue linked

condition 1 : linked id = 10309, 10703

condition 2 : issue type id = 10511, 10612, 10603

condition 3 : linked issue status = completion

issue edit : (number of condition1 & condition2 & condition3) / (total number of condition1) x 100

 

How to calculate (number of condition1 & condition2 & condition3) / (total number of condition1) x 100?

If it is not possible, can I calculate (number of completed linked issue) / (total linked issue)  x 100 ?

i solve my problem we have to use {{#=}} and at the end of use {{\}} and during formula use ( ) its too much important .

this is my formula:

{{#=}} ( {{issue.customfield_11237}} * 50 ) / {{issue.customfield_11238}} {{/}}

Suggest an answer

Log in or Sign up to answer