Forums

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

Time formula

Sheryl.Patton-Dandridge
November 17, 2022

Good morning - I need assistance with a time formula within an automation. I am trying to add a formula that will change the time and/or due date if a specific priority value is selected. Please assist - thanks so much!

Example: When Value changes for Priority, Priority equals Urgent, then edit issue fields Time to (increase by 2 hours)

So if a user entered the form at 10am, the due date is still today, but at 12noon.

1 answer

1 vote
Trudy Claspill
Community Champion
November 17, 2022

Hello @Sheryl.Patton-Dandridge 

Welcome to the community.

Have you reviewed the information available here?

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

What have you tried?

What is the type of the field you want to update?

If it is a date/time field then the "plus" function should do the trick.

Screen Shot 2022-11-17 at 10.11.25 AM.png

Sheryl.Patton-Dandridge
November 17, 2022

Thanks - so I will try this!

Sheryl.Patton-Dandridge
November 22, 2022

@Trudy Claspill I tried this - I'm getting closer, but no solution yet. I want to create the formula for same day plus 2 hours.

I'm using this: {{[date].plus[Hours]([number])}}

Is this correct? I feel like I may be missing something.

Trudy Claspill
Community Champion
November 22, 2022

Hello @Sheryl.Patton-Dandridge 

[text] represents something you have to replace.

[date] has to be replaced with a reference to the date/time field (or a date/time value) to which you want to add time; i.e. issue.duedate or now

[Unit] needs to be replaced with the time unit you want to use; i.e. plusHours

[number] needs to be replaced with the number of time units you want to add; i.e. 2

Are you trying to update a field that is only a time field or is it a date/time field?

Sheryl.Patton-Dandridge
November 22, 2022

It's a due date field - 

{{now.plusBusinessDays(0)}}

 

And a time field - 

{{{now].plus[Hours]([2])]]

 

But looking at the above, I need to take some of those symbols out, I think...the due date field is working fine. Let me change it - one moment.

Trudy Claspill
Community Champion
November 22, 2022
{{now.plusHours(2)}}

I don't believe that Jira Cloud natively has a field that is just a Time type field. I see Date Picker and Date Time Picker. Do you have an app that added a Time type of custom field?

If you have a field that truly is just a Time custom field then you will also need to add a format function to the above code to reduce it to just a time value, because now is a date/time value. The result of the above code would be a date/time value.

The document I linked previously has functions for formatting date/time data.

Suggest an answer

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

Atlassian Community Events