Requirement :
on edit screen
when I changed the value of a group picker
comment field should get madatory
Below is a behavior script which I implemented
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
@BaseScript
FieldBehaviours fieldBehaviours
def commentField = getFieldById("comment")def grouppickerfield = getFieldById("customfield_54400")
FormField field = getFieldById(getFieldChanged())
//log.error "g---------------"+commentField.getValue()+ "test:"+grouppickerfield.getValue();
log.error "<<<"+field.getFormValue()
if (field.getFormValue())
{
log.error ">>>in if condition" commentField.setRequired(true)
}
result :
It works for first time when I changed value. but second time, It is not working
Hi Prashant ,
probably you need to set commentField as not mandatory at the start of your code
{code}
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
...
commentField.setRequired(false);
...
@BaseScript
FieldBehaviours fieldBehaviours
def commentField = getFieldById("comment")def grouppickerfield = getFieldById("customfield_54400")
FormField field = getFieldById(getFieldChanged())
//log.error "g---------------"+commentField.getValue()+ "test:"+grouppickerfield.getValue();
log.error "<<<"+field.getFormValue()
if (field.getFormValue())
{
log.error ">>>in if condition" commentField.setRequired(true)
}
{code}
yup. I have the same configuration here. The comment field is not mandatory at startup.
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.