basically, i have a task that needs to (once autopopulated) set the due date to either tuesday or friday depending on which one is closer. i have no issues with making it populate to tuesday OR friday with {{now.withNextDayOfWeek("XXX")}}, but i know there is a function that can be used "min" to make it decide which one to assign it to. is there any solution to this? ive tried:
{{MIN(now.withNextDayOfWeek("TUE"), now.withNextDayOfWeek("FRI"))}}{{(now.withNextDayOfWeek("TUE"), now.withNextDayOfWeek("FRI"))MIN}}{{now.withNextDayOfWeek("TUE"),("FRI").min}}
Hi @Una Horne
Your syntax is not correct for using the min function...
The min function may be used with the long, format of a math expression or with a list of values (either numbers or dates / times).
One way to solve what you asked is to create a list of dates to use the min function:
{{now.withNextDayOfWeek("TUE").jiraDate.concat(",").concat(now.withNextDayOfWeek("FRI").jiraDate).split(",").toDate.min}}
How that works:
Kind regard,
Bill
wow, this looks like it worked!! ill know for sure if i try the rule again on friday. thank you so much @Bill Sheboy ! incredible :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FYI, another way to do this is with a conditional expression:
{{if(now.format("E").match("(Tue|Wed|Thu)").length().gt(0), now.withNextDayOfWeek("FRI").jiraDate, now.withNextDayOfWeek("TUE").jiraDate)}}
If we know today's day-of-week is Tuesday, we know we want the next Friday. Same thing with Wednesday and Thursday.
All other days lead us to the next Tuesday.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy i am fascinated with this, i am at the beginning of my jira experience. i have zero coding background. is there a resource you recommend for people like me where i can learn this kind of stuff? i have another thing im trying to do, and i get the feeling it is going to involve a more in-depth solution rather than my sloppy use of smart values pasted together like i tried before lol
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are up for some reading and experimentation, here are three automation articles I wrote (with the last one showing some more advanced topics):
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.