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