I want to set another field to be required according to the change of one date field. When the date field changes from a certain date to null, another field cannot be triggered to be required。
explain:on this date Fields ,implement behavior
code as follows:
def timeField = getFieldById(getFieldChanged())
def formField = getFieldById("comment")
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("执行时间")[0]
def currentDate = (underlyingIssue?.getCustomFieldValue(cf) as Date)?.dateString
if ((timeField?.value as Date)?.dateString != currentDate){
formField.setRequired(true)
}
else
{
formField.setRequired(false)
}
thanks for your response
Hi, I might have misunderstood the problem here so I will summarise my understanding.
When the date field does not have the current date make the comment required, is this right?
I have created a similar behaviour, all you need is to define that you want the comment field to be required and add your code there.
I am not sure what the getFieldChanged() does in your script as this will check every field in the screen rather than just the one that has the date?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I choose the field for the behaviour, so capture this date time change.
now , when date time from a some value to empty value,this script cannnot capture change.
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.