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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Calculate the Sum of custom field across projects Edited

Hi,

 

I have two projects, Incident Management and Problem Management. In the Incident Management project I have a field titled 'Total Agent Hours' that we fill in with a numeric value at the end of every incident to reflect how many hours it has cost us from an end user CS agent perspective. We then link our incidents to problem tickets in the Problem Management project. One problem can have multiple incidents linked to it if necessary. 

 

I would like to be able to set up a rule or automation that takes the 'Total Agent Hours' value from the incident tickets and returns a sum of them on the problem ticket. I would like this to update each time a new incident ticket is linked to the problem ticket so as to show a running total. For example:

Incident ticket 123 has a value of 10 agent hours, when it is linked to problem ticket 123 the value of 10 is shown in the agent hours field.

Incident ticket 345 has a value of 20 agent hours and is subsequently linked to problem ticket 123. The value in he agent hours field should now read 30. 

 

Is it possible to set this up using Project Automation? We do have scriptrunner installed, but this seems more complex to set up and I am the only one that can set these things up and I'm not good with scriptrunner! 

 

Many thanks for your help.

3 answers

Hi @anthony_butler 

Welcome to community! For Project Automation, if i'm understanding this correctly, we're looking at just a single field but different Project is it? If so I believe script runner might be a more suitable candidate for this use case. As i'm now wondering how to does the Automation know which tickets to calculate or will this be pre-determined?

 

Hi thanks for your reply. The tickets would come from a pre-determined project but would be different references. 

 

I'm happy to work with scriptrunner if you can offer any assistance with that side of things?

@Prince Nyeche I'm still struggling to get this done, do you have any suggestions at all? All of the advice I've been given so far, whilst it is brilliant, sadly hasn't worked. 

Prince Nyeche Community Leader Nov 12, 2020

Hi @anthony_butler 

Although Script runner  is an ideal candidate, I don't have a workable example out of the box I could use to explain this and Groovy isn't my strong suit yet so wouldn't be able to help much here with the coding aspect of it.

0 votes
John Funk Community Leader Oct 16, 2020

Hi Anthony,

You might be able to use Automation For Jira for that. Take a look at this post and see Rule #2 as a guide. 

https://community.atlassian.com/t5/Jira-Software-discussions/3-Jira-automation-rules-we-will-cover-in-our-advanced-webinar/m-p/1398109#M2801%3

Thanks John,

 

This looks like it might be a solution however, when I tried on Friday last week to make it work, I can only get it to remove a value from the field rather than adding it in. For example, 

I manually added in the value of 0 to the field in the Problem ticket. I ran this rule and updated the same field in a linked Incident ticket to 40. The rule told me it ran successfully (in the audit log) but when I went to the Problem ticket I found that the field had been cleared?

 

The only thing I changed was in the edit field section to match the field I needed to look up:

 

Edit field.PNGAny ideas where I'm going wrong?

 

Thanks,

Thought I should also include a screen grab of the whole rule in case I've really messed it up! :) 

 

Agent Hours automation.PNG

John Funk Community Leader Oct 19, 2020

Why do you have issue.inicident.Incident Cost and not just {{issue.Incident Cost? I think you have an extra incident word in there. 

Hi @John Funk thanks. No idea how that got in there! I've removed but the rule still doesn't pull the agent hours from the incident to the problem. The audit log doesn't show any errors which makes me think the rule is working but just not doing what I want it to do?

 

Rule Success.PNGAny ideas?

John Funk Community Leader Oct 19, 2020

Maybe it's a syntax thing. This is the format I use:

{{#=}}{{issue.customfield_16719}}-{{issue.customfield_17252}}{{/}}

Thanks four your help @John Funk really appreciate it. I'm now getting errors if I try and use the above (with my custom field id's).

 

I've tried a variation of both:

{{#=}}{{issue.customfield_14962}}-{{issue.customfield_14962}}{{/}}

and

{{#=}}{{issue.customfield_14962}}+{{issue.customfield_14962}}{{/}}

and for both I get the reult in audit log of 'Some Errors' and under the details I have the error of 'Missing parameter(s) for operator -u: -/+' (depending on the code above).

 

Sorry to be a massive pain, but anything else you can suggest? 

John Funk Community Leader Oct 20, 2020

In your example above you are subtracting (or adding) the same field from itself. Try a different number field for one of them and see if that is better. 

Thanks, I still get the same error when doing that too. I'm beggining to wonder if this is actually possible in Jira or whether or not I should look into eazyBI (we have that installed) to see if I could do it that way. It's not ideal but at least it would give us the information at a glance. Or even if Scriptrunner is something that I should explore more (I'm not very good with that either!) 

Do you have any suggestions as to how else I might be able to get this?

John Funk Community Leader Oct 20, 2020

That's really weird because it works fine for mine. 

I would go ahead and open a support ticket with Atlassian:

https://support.atlassian.com/contact/#/

Then please come back here and update with the resolution so we can help future folks, and can close this post out. 

Thanks I will do

John Funk Community Leader Nov 11, 2020

Anthony - can you post the latest rule that you have and what is not working with it? 

Can anyone suggest anything that could solve this with Scriptrunner?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

640 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you