Hi,
I want a field in Transition screen to be marked as Mandatory based on the value in Issue create screen. I have implemented this using Behavior add on the Create screen but the same is not working on the Transition screen.
Say choosing 'No' to a custom select field 'Are You using Rally' in create Issue screen need to make a field in Transition screen as mandatory. Kindly note i'm not going to display 'Are You using Rally' again in Transition screen for this purpose.
I have this code working without any issues in create issue screen. I have place this code under validator section of the Transition screen as Script validator. Any idea why it is not working in Transition screen.
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def compReviewSelectCf = getFieldById("customfield_18620") // parent filed
def vpCompJustSelectCf = getFieldById("customfield_18805") //child field.
if (compReviewSelectCf.getValue() == "Compliance Approval Not Needed"){
vpCompJustSelectCf.setRequired(true);
}
Hi Akbar,
The field would need to be on the screen for the behaviour to work. You could try setting up a Simple Scripted Validator on your workflow transition instead. See this page: https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/validators/simple-scripted-validators.html
Regards,
Josh
Hi Joshua,
I have done the following but still no luck.
1. I have put the parent field in the transition screen itself.
2. Used Simple scripted validator to trigger the mandatory validation
There is no change happening and validation is not triggering on change of parent field. Any idea? Also the setRequired and setVisible is also not working.
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.