I have two date custom Fields :
Defect logged date and Defect closed Date .
I want defect closed date to be greater than Defect logged Date .I would like to give message if the close date entered by the user is before the logged date . How do I do this using Behaviors using script runner .
I tried this code . its not working
one other thing I have made is I have disabled(grayed out ) the DetectedDateField field in the transition screen using behaviors. But I would imagine the Date value will still be collected by the get feild Id getFieldById("customfield_11703")
import com.onresolve.jira.groovy.user.FieldBehaviours
def DetectedDateField = getFieldById("customfield_11703")
def DetectedDateValue = DetectedDateField.getValue() as Date
def ClosedDateField = getFieldById("customfield_11600")
def ClosedDateValue = ClosedDateField.getValue() as Date
DetectedDateField.clearError()
ClosedDateField.clearError()
if (ClosedDateValue != null && DetectedDateValue != null ){
if(ClosedDateValue>DetectedDateValue){
ClosedDateField.setError("Defect Closed Date must be greater than Defect Detected Date")
}
}
Hi @Garden16_
Here's the script, modify and add it to behaviour to check the date field entered
Thanks,
Pramodh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is not working.
import com.onresolve.jira.groovy.user.FieldBehaviours
def DetectedDateField = getFieldById("customfield_11703")
def DetectedDateValue = DetectedDateField.getValue() as Date
def ClosedDateField = getFieldById("customfield_11600")
def ClosedDateValue = ClosedDateField.getValue() as Date
DetectedDateField.clearError()
ClosedDateField.clearError()
if (ClosedDateValue != null && DetectedDateValue != null ){
if(ClosedDateValue>DetectedDateValue){
ClosedDateField.setError("Defect Closed Date must be greater than Defect Detected Date")
}
}
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.