Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to determine a JQL where an issue was created 5 days prior to a person's "Start Date"

Greg Chapman September 17, 2020

Hey, I am trying to create a JQL query where a user creates a ticket, for Onboarding.  However, the issue tracks a separate "Start Date".  And I am wanting to display all issues, that have a 5 day difference between the issue's "Created Date" and the actual "Start Date".  Can anyone help?  Thanks community!

4 answers

3 accepted

0 votes
Answer accepted
Niranjan
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.
September 17, 2020

Hi @Greg Chapman ,

With script runner you can use a jql like

 

project=ABC and issueFunction in dateCompare("", "created = Start date+5d")

Greg Chapman September 17, 2020

Thank you, we leverage "Power scripts for Jira" plug-in.  Would the syntax be similar?  (I'm fairly new to scripting).

0 votes
Answer accepted
Jack Brickey
Community Champion
September 17, 2020

i think you can use Automation for this. Example of getting the difference between dates

{{issue.customfield_10015.diff(issue.customfield_10016).minutes}}

 Documentation - https://support.atlassian.com/jira-software-cloud/docs/use-smart-values-to-manipulate-and-format-dates/#calculating-the-difference-between-two-dates

Fazila Ashraf
Community Champion
September 17, 2020

@Jack Brickey  , this is nice.. Can this be used in a jql? 

Or should the value be stored on a field like a 'scripted field'?

Jack Brickey
Community Champion
September 17, 2020

do you mean a jql in a search or within the automation? TBH, i have not implemented so can't give you precise instructions. I do expect you can do this w/o needed a field to compare within automation. should be easy enough to try it out.

Niranjan
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.
September 17, 2020

project=ABC and issueFunction in dateCompare("", "created = Start date+5d") can be used as a jql I suppose

Greg Chapman September 17, 2020

@Jack Brickey we leverage "PowerScripts for Jira" and SIL manager as our tools for scripting.  This is my first time using this, as I am fairly new to Jira scripting.  I'm wondering how different the syntax is from what @Niranjan has provided.  (Thank you, btw.)

Jack Brickey
Community Champion
September 17, 2020

Quite different. Automation is built into Cloud and it does not require any scripting. Basically it is a lego like automation tool where you select various options and populate conditions, values, etc. if you give it a quick try I think you will find it intuitive. Project settings > Automation

0 votes
Answer accepted
Fazila Ashraf
Community Champion
September 17, 2020

@Greg Chapman ,  It is not possible to compare 2 fields in JIRA by default.

 

Do you have scriptrunner? If yes, you can look at https://scriptrunner-docs.connect.adaptavist.com/jiracloud/enhanced-search.html#_datecompare 

Greg Chapman September 17, 2020

We actually leverage "Powerscripts for Jira" as our tool to write custom scripts.  

0 votes
Alexey Matveev
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.
September 17, 2020

Hello @Greg Chapman ,

I believe that you should use a JQL like this:

key in silJQLExpression('startOfDay(created) < startOfDay(#{Start Date} - "5d")', 'project = YourProjectKey')

It would be nice if you had mentioned that you use Power Scripts in your question. In this case I would find your ticket faster.

Thank you! 

Suggest an answer

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

Atlassian Community Events