Hi All,
Need validation script for check box, here is the scenario,
i have a check box field which has only one option (yes) , when i checked Yes the dependent field is of Multi Select should be required .
i have used below code , could you help to correct it
cfValues['Soft Booking Needed?']*.value.contains("Yes") ^ cfValues['Soft Booking-Additional Instructions'] == null
Regards
Srikanth G
Hi,
Are you using Scriptrunner Behaviour for this?
If yes, you can add the following script to the "Soft Booking Needed?" field, and change out the customfield ID in the script to the ID of your dependent field.
Hope this helps
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def currentField = getFieldById(getFieldChanged())
def targetedField = getFieldById("customfield_11641")
String currentFieldValue = currentField.getValue()
if (currentFieldValue == "Yes") {
targetedField.setRequired(true)
}
Hello @Srikanth Gogineni
try this
!(cfValues['Soft Booking Needed?']?.value == "Yes" && cfValues['Soft Booking-Additional Instructions'] == null)
This condition will raise an error, when Soft Booking Needed field sets to Yes and "Soft-Booking-Additional Instructions" is empty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mark,
the above code did not work. any other way to approach
regards
Sikanth G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try:
!(cfValues['Soft Booking Needed?']?.value == "Yes" && cfValues['Soft Booking-Additional Instructions']*.value == null)
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.