Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,415,010
Community Members
 
Community Events
170
Community Groups

Assigning tickets depending of the hour of the day

Hi, in my Service Project I have two teams, one of them manages the issues created during the day time (until 17h CEST) and the other one manages the issues created during the nigh time (from 17h CEST).

 

I'm trying to automate the assignment process but I'm not being able to find a condition matching my criteria, I tried something like a JQL query as this one:

{{(now.plusHours(7).jiraDate).compareTo(now.plusDays(1).jiraDate)}} = 0

It doesn't work at all, but I'm trying to add 7 hours to now in order to compare it with tomorrow, if now+7 = tomorrow, it means that now is after 17h. I don't know if it is the best way to do it (I guess it is not), but I've not been able to find any doc to help me.

 

Best regards.

2 answers

2 accepted

2 votes
Answer accepted

Hi @Manuel Maldonado  -- Welcome to the Atlassian Community!

You can also do this with an advanced compare and regular expression check.  Please see this post for details:

https://community.atlassian.com/t5/Automation-questions/Assigning-round-robin-according-to-the-hour-of-the-day/qaq-p/1651142

 

Best regards,

Bill

Hi @Bill Sheboy, your solution worked great, you just need to take into account that "Created" value in a JQL is always at GTM timezone. This is how it turned out:

 

Captura de pantalla 2021-04-16 a las 11.08.39.png

 

Thanks so much! 

Like Bill Sheboy likes this

I am glad to hear that worked!

The way we solve the time zone issue is to adjust it before the condition test, rather than hard-code the altered time values.  That prevents issues with time changes for DST and data entry errors. 

For example:

{{issue.created.convertToTimeZone(issue.reporter.timeZone).format("hh")}}

Like Hana Kučerová likes this

@Manuel Maldonado can you send me screenshots of your solution. I did the same but seems only my AM shift is working. @Bill any help would be appreciated.

Use case: the am clock will assign to custom field 1 on an issue type. the pm clock will assign to custom field 2 on an issue type

Capture1.PNGCapture.PNG

Hi @BrentBot_ 

For something like this, please consider using one rule (not two) and an if/else condition to handle the two cases. 

The reason to do this: Your regular expressions overlap.  The tests for "1" and "2" in the AM-condition could be found inside of the PM-condition values, and so if the AM rule runs first it will "win".  If you perform both in one rule, testing for the PM-condition first, I believe this will work as expected.

Best regards,
Bill

@Bill Sheboy I have created an if/then but the AM is still winning. what am i doing wrong?Capture.PNG

Before your if/else clause, please add a write to the audit log for the value you are checking:

{{issue.updated.convertToTimeZone(issue.reporter.timeZone).format("hh")}}

And perhaps also log this value too (please note the format change):

{{issue.updated.convertToTimeZone(issue.reporter.timeZone).format("H")}}

I recall when I last tried this, the automation implementation did not seem to match this documentation, so reviewing different formats could help.

Then run your test again and check the audit log to see what value is there.  That may reveal why it is matching on a value that you do not expect.

1 vote
Answer accepted
Hana Kučerová Community Leader Apr 15, 2021

Hi @Manuel Maldonado

welcome to the Atlassian Community!

I believe you can use JQL condition for this, something like:

created >= startOfDay(9h) AND created <= startOfDay(17h)

 If issue is created between 9 AM and 5 PM, then ...

Hi @Hana Kučerová thanks so much for your solution, I I didn't get it to work but I think it was because of the timezone, as my test were done assuming that the dates would be at CEST and they are actually at GTM.

 

However, I finally took @Bill Sheboy solution and (after noticing it was failing because of the timezone) it worked!

 

Thanks so much anyway!

Like Hana Kučerová likes this

Suggest an answer

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

Atlassian Community Events