I need to make a field called "Reason for Cancellation" mandatory if in the resolution of the problem it selects Canceled. But the script is not doing this function.
If not cancelled, the field must be optional.
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
def resolution = getFieldByName ("Resolution")
def motivo = getFieldByName ("Motivo do Cancelamento")
motivo.setRequired(false)
def selectListValue = resolution.getValue()
if (selectListValue == "Cancelado") {
motivo.setRequired(true)
}
But the script above is not working.
Hi @Yuri Edward Schulze ,
please try the following code :
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
def resolution = getFieldById("resolution")
def motivo = getFieldByName("Motivo do Cancelamento")
motivo.setRequired(false)
if (resolution.name == "Cancelado") {
motivo.setRequired(true)
}
Hope this helps,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try with :
both should work properly.
Ciao,
Fabio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Even with the updates you sent me along with the script, they didn't take effect and the validation doesn't take place
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
def resolution = getFieldById("resolution")
def motivo = getFieldByName("Motivo do Cancelamento")
motivo.setRequired(false)
if (resolution.getValue() == "Cancelado") {
motivo.setRequired(true)
}
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
def resolution = getFieldById("resolution")
def motivo = getFieldByName("Motivo do Cancelamento")
motivo.setRequired(false)
if (resolution.value == "Cancelado") {
motivo.setRequired(true)
}
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.