Forums

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

Add a Static Time to a datetime field

Chris Lynch
Contributor
October 19, 2022

Hi,

On my request form I have a date field and a radio button to allow users select a Deployment Date and Window. Based on these I have Jira Automation to set the Planned Start datetime field and Planned End datetime field with the Date from Deployment Date and I want to set the static Hour depending on the window taken.

I can use smart values in Automation on Planned Start {{issue.Deployment Date}} - this sets the Planned Start Datetime as Deployment Date 01:00. So a Deployment Date of 20/Oct/2022 appears as 20/Oct/2022 01:00 when I look at the issue. I then assumed I could do something like {{issue.Deployment Date.plusHours(8)}} which would give me Deployment Date 09:00 but when I use the plusHours the Planned Date is not populated.

Should this be possible or can I do something like ({{issue.Deployment Date}} 09:00)

2 answers

1 accepted

0 votes
Answer accepted
Chris Lynch
Contributor
October 20, 2022

My solution here was to use 2 Automations

1. Sets the {{issue.Deployment Date}} for Planned Start - adding 20/Oct/2022 01:00. This automation also sets a new field called Set Change Window as true (checkbox).

2. Second automation check if Set Change Window changes to true and then applies the {{issue.Planned Start.plusHours(8)}}. Need to allow this automation to be triggered by other automations.

This works as expected.

0 votes
Patricia Francezi
Community Champion
October 19, 2022

Hi @Chris Lynch 

Usually this happens when doing operations btw jira system fields and custom fields, as the formats available on custom fields are different 

I had a similar problem with SLAs smart values. 

So we may need to change the format for the Deployment Date, then do the plus operations

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

Chris Lynch
Contributor
October 19, 2022

Thanks,

How would you do that in the field available for setting the Planned Start datetime?

{{issue.Deployment Date.jiraDateTime.plusHours(8)}} doesn't work either

 

Thanks again

Chirs

 

Like Patricia Francezi likes this
Patricia Francezi
Community Champion
October 20, 2022

Try just "jira."

When I had the problem i inspected the field properties using rest api to see the options. 

Chris Lynch
Contributor
October 20, 2022

This didn't work either for me. I've posted above what does work as a work around.

 

Thanks for your help

Like Patricia Francezi 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

Atlassian Community Events