Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Validator for the Due Date to be Sundays only


My project has a validator for certain issue types to make sure issues have a due date when changing the status to "In Progress".
I'd like the validator (or a different one) to also make sure that due date is only Sundays.

We have ScriptRunner.

Is that possible?


1 answer

1 accepted

0 votes
Answer accepted

Hello @Neta Knyazhansky Caspy

If I understand correctly, you would like the "Due Date" field to only allow dates that fall on a Sunday, correct?

Hey @Patrik Korovsky ,

Yes, you're exactly right.

I have no experience with ScriptRunner.

I propose an automation that sets the "Due Date" field to the next Sunday based on the input. The change is observable after a refresh.

Automation setup:

  1. The trigger will be "Field value changed"
  2. We will add an "If block" so that if we set the Due Date on a Sunday it will not be set to the next week's Sunday, but remains on the selected date. The Advanced compare condition will be: 
    1. {{issue.Duedate.plusDays(7)}} does not equal {{issue.Duedate.withNextDayOfWeek("SUN")}}
  3. The action will be an "Edit issue" and we will set the "Due date" to be a smart value "{{Duedate.withNextDayOfWeek("SUN")}}"

The full automation looks like this:

Thank you for such a detailed response, I appreciate it.

In this case, the due date doesn't have to be the following Sunday, it can be any Sunday.
Any ideas?

Would you accept an automation that sets the Due Date to the previous Sunday if a date in the future is selected Mo-Sat?

If yes, I can create it for you as well with the check that Due Date is automatically set to the next Sunday if set in the past or present week Mo-Sat.

Logically this would make sense to me.
Unfortunately I could not find a validation/condition to bind this to in the workflow.

This would be a perfect solution.

If the due date is set to Mon-Sat, then it will automatically change to the *following* Sunday.

I'd very much appreciate your assistance. 

You wrote that if the date is Mon-Sat, then it is set to the following Sunday.
In my previous comment I wrote that it would be set to the previous Sunday.,

My logic is that if the due date is set for, say, Friday, December 16, 2022, then it would make sense to me that it has to be done by that date.

  • If we set it to the following Sunday: 18 (+2 Days Due Date)
  • If we set it to the previous Sunday: 11 (-5 Days Due Date)

To meet the due date, we need to stay at -X or 0 days Due Date.

I see three options:

  • Always set the Due date to the next Sunday
  • Always set the Due date to the previous Sunday
  • Set the Due date to the closest day to input
    • Mo, Tue, Wed -> Previous Sunday
    • Thu, Fri, Sat -> Following Sunday


  • If current week is chosen, always set it to that week's Sunday
  • If we set to the previous Sunday, always check that it does not land in the past

The use case is that deployment is part of our DoD and we only deploy on Sunday, so even if the work is done Mon-Sat, the Story can only be closed after the deployment on the following Sunday.

Therefore, option #1 is the best - Always set the Due date to the next Sunday.

In that case my previous detailed comment from 28th November is applicable. It works for any week not only the next Sunday (that was just an example I gave).


  • Automation changes the date
  • Automation notifies the user of a change (Optional)

Here is the full setup with a recommendation:

  1. Field value changed (Trigger)
  2. Re-fetch issue data (Advanced action)
    1. (Optional, we need it so the automation can properly comment)
  3. Create variable (Advanced action)
    1. (Optional, we need it so the automation can properly comment)
    2. Choose a variable name (I chose "InputDate")
      1. Choose what your variable saves: {{Duedate.fullDate}}
  4. Create an if block where:
    1. {{issue.Duedate.plusDays(7)}} does not equal {{issue.Duedate.withNextDayOfWeek("SUN")}}
  5. Edit (Action)
    1. Due date to "{{Duedate.withNextDayOfWeek("SUN")}}"
  6. Re-fetch issue data (Advanced action)
    1. (Optional, we need it so the automation can properly comment)
  7. Add a comment (Action)
    1. (Optional)
    2. The comment will read: Hello [~accountid:{{initiator.accountId}}],
      You have set the due date to *{{InputDate}}*.
      Since the due date can only fall on a Sunday, the automation updated the due date to *{{Duedate.fullDate}}*.
    3. Note that the "InputDate" depends on the name you chose in step 3.


Final thoughts:

  • I recommend adding a comment so that everyone sees what is happening
    • You can set the comment to be visible only to a certain role, but keep in mind that the rule Actor is "Automation for Jira" which only has the "atlassian-addons-project-access" role
    • If you want to get around my previous point with a certain amount of elegance, I recommend creating a new user with a name similar to this one "Your Company name Automation" and giving it the role under which you want the Actor to comment
  • Certain smart values I have chosen to my liking, you might prefer a different format to the Due Date I selected, you can read more on formatting dates here
    • I also set the automation to tag the user, if you prefer just the name, replace [~accountid:{{initiator.accountId}}] with {{initiator.displayName}}
  • I din't cover that if the due date is set before the current week, it will be set to Sunday of the current week. Let me know if you would appreciate that.

If you have any questions or are struggling with something let me know. I will be happy to help.

You are the BEST!

The only thing that isn't working is the InputDate in the comment, it looks like this:
"You have set the due date to **."

I guess something needs to be changed in step 3?
Any ideas?

Like Patrik Korovsky likes this

Happy to hear this works for you. I had a lot of fun with this automation.

Can you please share how you approached the third step?
If I follow my example it should look like this:

  • Note that you have to specify the "Due Date" date format in the variable when creating it, not later on in the 7. step (that would not work)

I can imagine that automating the visibility of comments (or creating a new account for this) can also be tricky, so if you get stuck, feel free to ask for help in that area as well.

Adding the comment automation (step 7.) so you have the full picture.

I found what wasn't configured correctly.

I didn't realize the configuration is case-sensitive so the Variable name in step 3 didn't match the syntax in step 7.
I fixed it and it's working perfectly now.

I can't express my thanks to you in words!!

Like Patrik Korovsky likes this

Suggest an answer

Log in or Sign up to answer