if a ticket is created between 2000hrs and 0700 hrs in project A then create a cloned ticket in Project B
How can I achieve this automation
I am targeting to solve an issue which is caused by difference in time zones
Hello @stephen.abiero
The basic structure of the rule would be:
Trigger: Issue Created
Condition: Advanced Compare
compare the time portion of now to your time range
Action: Clone Issue
The challenging part is in extracting the time value of now and comparing it to your time range, with consideration for the timezone.
When you look at the date and time returned by the {{now}} smart value, that will be in UTC by default. If you want to convert it to a particular timezone you need to add a function to do that. Look at the convertToTimeZone function here:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/
If you then want to extract just the time portion of that value you need to use the format function. Additional codes for formatting dates and times can be found here:
https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
It looks like you only care about the hour portion of the time.
To get the value converted for a particular timezone and get the time in a 24 hour format that you can compare to your time range you would use a smart value like this:
{{now.convertToTimeZone("Australia/Sydney").format("k")}}
That would return the hour portion of the time as a value 1-24.
You could then compare that value to see if it was greater than 20 or less than 7, and then clone the issue based on that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.