I would like to populate custom date in date field.
Custom date calculated as below
=IF(OR(WEEKDAY(Date)=3,WEEKDAY(Date)=4,WEEKDAY(Date)=5,WEEKDAY(Date)=6,WEEKDAY(Date)=7),(Date+7-WEEKDAY(Date)+2),IF(OR(WEEKDAY(Date)=1,WEEKDAY(Date)=2),(Date+7-WEEKDAY(Date)+4),"0"))
Any help on using this logic using post function "Script Post-Function" or "Scripted (Groovy) operation on issue (JMWE add-on)"
Thanks
Hi,
using JMWE, you can just use a "Set Field Value (JMWE add-on)" post-function and select "Groovy Expression" as the value type. Then for the value script, can you specify:
- what "Date" is: current date (now)?
- what WEEKDAY does: return the day of the week I suppose, but then what is WEEKDAY 1? Monday? Sunday?
Weekday expression mentioned is from excel. 1 - 7 as Monday through Sunday.
I am looking for some sample scripts to get started!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You didn't answer my other question about what "Date" means, so I'll assume the current date. You'll just need to update the first line if you meant something else.
Date date = new Date();
int day = date.day;
if (day==0)
day = 7;//Java/Groovy Sunday is 0
if (day >= 3)
return date + 7 - day + 2;
else
return date + 7 - day + 4;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks David. Yes, Date above is the current date and time.
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.