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
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.
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.