Hi,
I would have a required field (RespoTRA) when other field (DetectEnviro) have specific value : "Production"
I use this script with script runner (in behavior).
import com.atlassian.jira.component.ComponentAccessor
def DetectEnviro = getFieldById("customfield_10232")
def RespoTRA = getFieldById("customfield_10248")
if (DetectEnviro.getValue() == "Production") {
RespoTRA.setRequired(true)
}
else {
RespoTRA.setRequired(false)
}
That works but not all time.
When I open eddit screen, if the value is Production, I can validate even if RespoTRA is empty. The second time it's work.
And if I change the value of DetectEnviro (with other than Production), RespoTRA stay required while it should not. If I look in list of RespoTRA the required disappears.
I didn't manage to use initializer...
Can someone help me ?
Hi @Boris Demain ,
The script looks fine ; you should use it in the initializer and also bind it with the DetectEnviro field.
If that does not work, check the logs and maybe add
log.error("DetectEnviro value : " + DetectEnviro.getValue())
Antoine
Thank you so much !
My mistake was to bind with wrong field the script.
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.