Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Initialize min value of datepicker in customer portal

Hello,
I am looking for a solution in order to be able to enter the minimum value of a datepicker (due date) when the customer create a request in the customer portal.

If possible without going through a validator, I would like the datepicker to be grayed out on certain date ranges. With scriptrunner behaviours ?

Thank you in advance for your help

1 answer

0 votes

You can't make the dates grey or block them in any way (plus dates can alse be entered by typing).

But with a behaviour script, you can validate the date as soon as it's selected and raise an error if it's not valid.

Something along these lines:

import groovy.time.TimeCategory
def
field = getFieldById(getFieldChanged())
field.clearError()
def date = field.value
if(date)
date.clearTime() //ignore the time of day
def today = new Date().clearTime()
use(TimeCategory) {
if (date.before(today.plus(14.day))) {
field.setError("The due date can not be in the next 14 days")
}
}
}

Be careful to only apply this with portal mapping. Or else if you try to edit the issue after the due date, you will be forced to change the due date to 2 weeks in the future. But since portal configurations are only applicable on create screen, it won't be a problem.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.14.1
TAGS

Community Events

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

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you