Hi All,
I am trying to make a field mandatory based on value in the another field using below code in script runner. But it is not working 100% correctly -
- When i create a JIRA ticket and make the select 1 in the field "Quality Assessment", it doesnt show "Quality Comment" field as mandatory. We have to click on update and again edit the JIRA ticket to see the field "Quality Comment" as mandatory.
- Also it doesnt stop state transition even when the field is made mandatory and not filled.
The only thing it does is that it doesnt allow to edit the JIRA till the time we fill the mandatory field field "Quality Comment".
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
def sourcefield = getFieldByName('Quality Assessment')
def RCAfield = getFieldByName('Quality Comment')
String sourceValue = sourcefield.getValue()
if(sourceValue.startsWith("1")){
RCAfield.setRequired(true);
} else {
RCAfield.setRequired(false);
}
How can I resolve our two problems mentioned above. Even if we are able to solve the second problem of transitioning then also i am okay.
Thanks,