Hello,
I am trying to utilize Automation for Jira to check if specific comment by customer falls under a certain time of the day, it will notify different people depending on the time the comment is made.
For example, I have 3 teams
Team 1 - 12AM to before 8am ET
Team 2 - 8am-4pm ET
Team 3 - 4pm ET to before 12MN
So for example, if customer comment is made between 8am-4pm ET, it should send email (automation rule action) to Team 2. Same thing other time of the day to notify either Team 1 or Team 3.
{{issue.comments.last.created}}
less than
startOfDay()
Tried the above Advanced Compare condition or even If/else via JQL (where I am able to identify the short time through this:
{{issue.comments.last.created.shortTime}}
But JQL parsing errors shows as when value returns 2:48 PM (or any time)
Error in the JQL Query: Expecting operator but got 'PM'. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'.
I would appreciate any feedback and suggestions.
I would can to do it by myGroovy plugin, if you have it on your Jira instance. But how would be this team notification? Via e-mail?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Michael Vidallon ,
This was an interesting one to try to solve. The inherent problem with leveraging time as a variable in cloud is all of the functions like startOfDay() are relative to the server time.
When you're viewing time through the UI, it converts the values based on the default timezone set in the server settings but doesn't necessarily match the value stored. So part of your solution has to include converting the comment timestamp and the value you're comparing against into the timezone you're working with.
As an example, when I was running a test
{{issue.comments.last.created.shortTime}}
gave me "7:49 PM", but when I used the function to convert it to my timezone
{{issue.comments.last.created.convertToTimeZone("America/Chicago").shortTime}}
I got "2:49 PM" as an output.
The example below is using the server time for the instance I'm working with, but that might not reflect the server time of your instance. I would recommend running a log action to output:
{{now}}
{{now.convertToTimeZone("America/New_York")}
to find the differential.
Here's the comparison I put together that fits your 'Team 1' example:
The first value converts the comment timestamp to the EST timezone, the second is the time value to compare against.
{{now.toStartOfDay.minusHours(20).convertToTimeZone("America/New_York").shortTime}}
There are two advanced compares with an AND statement in between so you can ensure the value sits between the two target times. In the example above it's greater than Midnight, and Less than 8 AM.
When you craft your rule then, you can use an if/else block with two of these advanced compares for each set of times making adjustments with the minusHours() or plusHours() function as necessary to give you the desired value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.