Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

Multiply via automation Time tracking (log work) field

Esteban Halabi
Contributor
July 29, 2023

Hi everyone, first off let me thank you for your time reading this.

The following question is for Jira Software Cloud.

 

I'm trying to do a multiplication with an automation.

 

Context: I have a "client rate" field that captures the cost per hour for a specific client. Different clients have different rates.

 

Goal: When a user Logs Time on a ticket, that time should be multiplied by the client rate to give me a value of Actual cost (another custom field that we have)

 

So for example

Client Rate: 1500

Time logged = 30m

Actual cost = 750

 

I'm having issues achieving this with the automation, I keep getting errors.

 

Screenshot 2023-07-29 190803.png Screenshot 2023-07-29 190848.png

 

As an additional detail, the time is being logged through Tempo. 

 

Hopefully you can assist :) 

Thank you all

1 answer

1 accepted

0 votes
Answer accepted
Ste Wright
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 29, 2023 edited

Hi @Esteban Halabi 

I find it easier to use variables on these occasions - the below rule:

  • Calculates the time spent in seconds
  • Turns this into hours/minutes (based on 2 decimal places)
  • Then calculates the result

A few notes:

  • The "Re-fetch issue data" actions help ensure the rule runs in order
  • You can change the decimal points by editing the after the comma, in the variable {{timelogged}}
  • There is a shorter method with one less variable, you create {{timelogged}} using {{issue.timetracking.timeSpentSeconds.divide(3600)}}, but it kept rounding to the nearest hour for me, so I used two variable instead

---

  • Trigger: Work Logged
    • For = All Operations
  • Action: Create Variable
    • Name = seconds
    • Smart Value = {{issue.timespent}}
  • Action: Re-fetch issue data
  • Action: Create Variable
    • Name = timelogged
    • Smart Value = {{#=}}ROUND(({{seconds}} / 60 / 60),2){{/}}
  • Action: Re-fetch issue data
  • Action: Edit Issue
    • Field = Actual Cost
      • {{issue.Client Rate}} * {{timelogged}}

---

Let us know if this works for you!

Ste

Esteban Halabi
Contributor
August 1, 2023

Thank you Stephen! I'll look into it give it a try and let you know :) 

Esteban Halabi
Contributor
August 1, 2023

Worked like a charm! I appreciate your help so much!

 

Could've never figured it out on my own :) Thank you

Esteban Halabi
Contributor
August 1, 2023

Stephen Wright _Elabor8_ 

 

If I may pick your brain once more. I was trying to replicate the same behavior but now to calculate the "estimated cost" based on the Original estimate field. So based on the previous automation I did the followingScreenshot 2023-08-01 144341.png Screenshot 2023-08-01 144404.png Screenshot 2023-08-01 144407.png

 

However after running it I got this error.

Screenshot 2023-08-01 144458.png

 

I was able to trigger it successfully but it seems I messed up the "timeestimated" variable.

 

It's my first time dealing with creating variables so I apologize.

 

Thank you again

Esteban Halabi
Contributor
August 1, 2023

I figured out my mistake! disregard! fixed now! 

Like Ste Wright likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Upcoming Jira Events