Hi Team,
I have check box field called Instance and values are " Dev" ,"Production", "Stage" and I have Date field called "Estimated end Date"
If I select Instance = Dev, Estimated end date should allow me to select date after 5 days.
If I select Instance = Stage, Estimated end date should allow me to select date after 10 days.
If I select Instance = Production, Estimated end date should allow me to select date after 15 days.
You could try something like this:
def instanceFld = getFieldByName("Instance")
def estimatedDateFld = getFieldByName("Estimated end date")
instanceFld.clearError()
estimatedDateFld.clearError()
if(instanceFld.value instanceof ArrayList){
instanceFld.setError("Please select only one")
return
}
if(estimatedDateFld.value){
if(!instanceFld.value){
instanceFld.setError("Please select at least one instance before selecting a date")
estimatedDateFld.setFormValue(null)
return
}
def today = new Date()
def dueDateInterval = estimatedDateFld.value - today
def instanceMinDays = [Production:15, Dev:5, Stage:10]
if(dueDateInterval <= instanceMinDays["$instanceFld.value.value"]){
estimatedDateFld.setError("Estimated end date must be more than ${instanceMinDays["$instanceFld.value.value"]} days from now")
}
}
I would put this code in both fields so that if either is changed, both will be re-validated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Musku Nagaraju
I don't think you can place a check within the date popup itself, what you can do easily (using Script runner plugin Behaviour module) is when someone selects a date and that doesn't match the criteria which you listed
like- Dev, Estimated end date should allow me to select date after 5 days.
Then the user will see an error and unless he selects another date he will not be able to submit the form.
A similar query is here - https://community.atlassian.com/t5/Jira-questions/Is-it-possible-to-restrict-the-Due-Date-field-entry-to-only-take/qaq-p/259268
The suggestions were about writing a custom validator in the workflow transition which is also possible in your case but that's server side while the behaviour module which I suggest works on client side.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tarun Sapra , I tried this but this is not working currently what I am looking. This will allow me only to select date in future and past but not based on another filed values,
I hope this will achieve with using Script runner plugin Behavior module.
Kindly help me the right code?
Thanks
Nagaraju
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.