Hi All
I have a scenario where i have a single list type Field called "Requirement Type",Which has two values Functional and Non-Functional.
Functional doesnt contaion any specific values, but Non Function is a tab and it will only show when requirement type is Non-Functional and it has some fields values like, Correspondence, Physical requirements etc.
My requirement is two make all the fields under functional and non-functional as required when status goes from "In Progress" to " Complete".
Previously i have added in workflow validator all the fields should be required, but now i am facing a the problem like when i have filled all the details (not Nun Functional Details) and trying to progress from one state to another all those Non Functional fields are also saying error messages like its Required.
below i have tried the code but its not working, i have tried in Behavior and Script Validator in Workflow, but unable to do it.
Can anyone help me on this ? I am new to Behaviors .
Behavior Code : ----
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import groovy.transform.BaseScript
import org.apache.log4j.Level ;
import org.apache.log4j.Logger ;
log.setLevel(Level.DEBUG) ;
@BaseScript FieldBehaviours fieldBehaviours
FormField dropDownList = getFieldByName("Requirement Type")
FormField condition1 = getFieldByName("Correspondence:") // Corresponde field
//FormField condition2 = getFieldById("12254")
if(dropDownList == "Non-Functional"){
condition1.setRequired(true)
}
else{
condition1.setRequired(false)
}
Script validator Code : --
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
FormField condition2 = getFieldById("12254")
if(issue.getAsString("customfield_16300") == "Non-Functional"){
condition2.setRequired(true)
}else{
condition2.setRequired(false)
}
Regards
Manas