Hi there,
I'm stuck. 🤔
I'm looking for a way to define a card color depending on the difference of two date fields.
Let's assume there are two date fields - "start date" and "end date".
How can I easily color tickets on the board if "end date" - "start date" > 90 days?
Can someone please point me to the solution or give me a hint?
Thanks and best
Eric
Hi Eric,
To define JQL to compare two dates, you cannot do this out of the box and will need to use a third-party app such as ScriptRunner for Jira Cloud.
You can then use the Enhanced search page to define a query using the dateCompare function to return issues that match your calculation of end date" - "start date" > 90 days.
Once you have defined your filter on your enhanced search page you can use it in the card colour query by following the steps below.
1. Save the filter and share it (This creates a copy of the filter as a standard Jira filter where we synchronise the list of issue keys returned by the enhanced search filter.)
2. Navigate to the card query section of the board and reference your filter in the JQL box using the JQL like below.
filter='NameOfHisSharedESFilter'
If you want just the enhanced search JQL functions, then we have the standalone Enhanced Search app that provides these at a smaller cost.
I hope this helps.
Regards,
Kristian
Great explanation, @Kristian Walker _Adaptavist_ - thanks for that! 👍
I'll check and discuss it with our Jira admin and then I might come back to you... if I may😉
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Fyi, we checked it and found several issues:
To solve the issue we did the following:
So here's the final JQL:
issueFunction in expression("project = ABC", "customfield_XXX - customfield_YYY >= 7746000000")
A bit strange but it worked finally - at least for us. 😉
Thanks for the initial input, @Kristian Walker _Adaptavist_ !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eric,
Thank you for the feedback and for sharing your final solution.
Just for reference, I have checked, and using the enhanced search Query Builder you can select custom date fields to use in the date compare function, as shown below.
I'm glad we helped you get a working solution to your requirements.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You cannot use JQL to test the difference between two dates.
Instead, you could implement an automation that:
Then you can use a JQL to test for the label (approach 1) or to test for the custom field value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Automation is available for Jira Data Center, yes! Also, you can implement calculated custom fields with other apps, for example with ScriptRunner.
Maybe the question is are you already using any app to implement automations in any way?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, I just realized that Automation is already part of Jira Data Center (and there is no addition costs associated with it)!
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.
Hello @Eric Haas
You can do this by selecting the method of queries:
Based on a JQL query you can define the color of start and the end dates.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, thanks a lot...!
I know where to define it... but - at least for me 🤔 - I can't define a formula similar to this:
("end date" - "start date") > 90d
Maybe I just don't get it?
Or do I need an additional custom field first which calculates the difference of the dates?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With JQL this wouldn't be possible, rather with an automation rule. You would create two custom fields for start and the end date which will fetch when the issue has started and when the issue has ended and to do the calculation:
{{issue.fields.customfield_10074.diff(issue.fields.customfield_example)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Many thanks for the info, @Nikola Perisic ! 👍
Just for my understanding:
Do automation rules only work with Jira Cloud or do they also work with Jira (on-prem)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problem @Eric Haas
You should be having the Automation for Jira app, if not you can navigate to the marketplace and search for this app.
Also you can check the Manage apps field to see if there is Automation for Jira installed.
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.