Hi Dear Colleagues,
I need a script for behavior, that will not allow selecting past date when creating a ticket for the date-time picker field. I have a scriptrunner and want to do it with behavior. Or advise another solution.
A server-side script attached to the date field works like this:
import com.onresolve.jira.groovy.user.FormField
FormField dateField = getFieldById(getFieldChanged())
Date value = (Date) dateField.getValue()
Date today = new Date()
if (value != null && value.before(today))
dateField.setError("Date must not be in the past")
else
dateField.clearError()
Hi, Dear @Radek Dostál
Thanks for the provided script, it worked for the create screen, but from the Customer Portal it is not working, but I did mapping with the issue type.
Please advice.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to add service management mapping to the behaviour to make it work on portals (software and service desk both need specific mapping in behaviours). Other than that I think the same thing should work, so just the mapping.
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.
Hi @Gor Greyan
I have provided a similar solution in this Community Post.
In the Community Post link provided, the Behaviour will throw an error if the Completion Due date is before the Issue Submission date.
Please take a look and let me know if you need further help with the code.
Thank you and Kind regards,
Ram
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.