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,554,452
Community Members
 
Community Events
184
Community Groups

How add N hours to a custom date-time field

My project has a 3 custom fields:

    start-date-time, end-date-time, elapsed time

Whenever the start-date-time or elapsed-time values change I want to recalculate and set the end-date-time value like:

    end-date-time = startdate-time + elapsed-time

I am using Jira Automation and when the value changes for the elapsed-time custom field I tried to set the new end-date-time via:

{
  "fields": {
    "customfield_14201": "{{customfield_14200.addHours({{fieldChange.toString}})}}"
  }
}

but I get the error:

Failed to get value for customfield_14200.addHours({{fieldChange.toString}})}}

Is there a way to do this with Automation rules?

1 answer

1 accepted

0 votes
Answer accepted
Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 15, 2022 • edited

Hi @Randy Taylor 

Could you use smartvalue instead sending json data ?

Try using this into the end date time field.

{{issue.customfield_14200.plusHours(issue.customfield_XXX)}}

When XXX is the field id of elapse time field.

smartValueEditDateTime.PNG

 

Regards

When I try just

{{issue.customfield_14200.addHours(5)}}

it just unsets the value.  I think the interpreter does not understand the .addHours(5) syntax and just returns null or undefined.

Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 17, 2022

Hi @Randy Taylor 

 

Sorry it's plusHours, not addHours

 

https://confluence.atlassian.com/automation/jira-smart-values-date-and-time-993924864.html

plusHours is for the cloud version.

Regards

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events