Using ScriptRunner, can I search for a specific time on a specific weekday?

Sebastian P. (beecom) December 29, 2020

Hi there

I know that I can use 

project = ABC AND ((created > startOfWeek("+2d")  AND created < startOfWeek("+7d")))

to look for issues created between Tuesday and Saturday. But what I need is to narrow the range down to issues created between Tuesday 09:00 and Saturday 06:00.

I know JQL can't do it. Can I use ScriptRunner's JQL functions (or a custom function) to do this?

Best regards

 

Sebastian

2 answers

2 accepted

0 votes
Answer accepted
Juan José Marchal Gómez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2020

Hello @Sebastian P. (beecom) ,

Yes, with ScriptRunner this can be done.

You can create a function with Scriptrunner that the params will be date and inside the code, set the time that you want. WIth the option "JQL Functions".

Later on, when the Function is developed you can use "IssueFunctionIn" of Scriptrunner in all the JQL that you want to use.

Best regards.

Sebastian P. (beecom) January 4, 2021

Hi @Juan José Marchal Gómez 

This pointed me in the right direction, even though I used Liam's approach, this  will still be helpful in the future.

Thanks!

Cheers,

Sebastian

0 votes
Answer accepted
Liam Green
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 29, 2020

Hi @Sebastian P. (beecom) 

If you work it out in hours then you could use JQL.  E.g. 09:00 Tuesday would be startofWeek("+57h) and 06:00 Saturday would be startofWeek("+174h).

Hope that helps,

Regards, Liam

Sebastian P. (beecom) January 4, 2021

Hi @Liam Green 

Thanks, this didn't even occur to me even though it is so simple...

Cheers,

Sebastian

Like Liam Green likes this
Liam Green
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 5, 2021

Glad it helped!

Suggest an answer

Log in or Sign up to answer