Hello everyone,
I was trying for few hours without any success.
I have a date field, which I convert to time zone and format to short date.
{{issue.customfield_11123.convertToTimeZone("Asia/Jerusalem").shortTime}}
If want to create the following condition and actions:
1. if the time is between or equal to 00:00 AM - 06:00 AM
then I want to reduce 1 day from the customfield_11123 date and set the time to 05:00 AM
for example if my customfield_11123 is 02/06/2023 03:00 AM, then I want to get this output: 01/06/2023 05:00 AM
2. then the opposite condition, if the time is not between 00:00 AM - 06:00 AM
then I want to change the time value of customfield_11123 and set the time to 05:00 AM
for example if my customfield_11123 is 02/06/2023 10:00 AM, then I want to get this output: 02/06/2023 05:00 AM
anyone have a good way to go it using jira automation / smart values ?
Hi @Tal Sabag
You would use If/Else with advanced condition:
{{issue.customfield_11123.convertToTimeZone("Asia/Jerusalem").format("H")}}
Less Then
6
This will look at the field and determine if it is before 6:00 AM Asia/Jerusalem time
Then you would add an Edit Issue action to change the date accordingly:
{{issue.customfield_11123.minusDays(1).withHour(5).withMinute(0)}}
Your Else condition would be something like this:
{{issue.customfield_11123.withHour(5).withMinute(0)}}
I haven't tested so it may require a little bit of play. I'd recommend running tests with these strings writing to the log so you can tease it out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.