Hi There! I'm trying to update my Expected Due Date field to be 3 business days from the Created Date. This is just a date field (not date/time). I want to exclude weekends (Saturday and Sunday) when calculating the Expected Due Date.
I do have access to ScriptRunner and JMWE to set up this post-function; I'm just unfamiliar with Groovy expressions. I'm using Jira Server v7.10.1.
Any advice would be greatly appreciated!
Create a JMWE Scripted Operation post function on your Create transition. Field will be Due Date, Value Type will be Groovy Expression, and Value will be that script, with the final line being date(new Date(),3)
Hope this helps,
Hi @Payne ! I'm now trying to customize this a bit further. If a user inputs the ticket after 4:00 PM EST, I want to add an additional business day to the due date. I'm currently using the code provided in the link you sent over. Do you have any advice on how to customize?
So, what you want to do is send an argument of 4 days rather than 3 days if the current hour is 4pm or greater (16 on a 24-hour clock). So, here's one approach; change your final line where you call date(from,nod) to:
def hour = cal.get(Calendar.HOUR_OF_DAY)
def numDaysToAdd = 3 + (hour >= 16 ? 1 : 0)
You may not recognize (hour >= 16 ? 1 : 0) ; that's using the ternary operator, which is a way to shortcut an if-then-else construct.
condition ? value if true : value if false
Hope this helps,
I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event