I am trying to make a field required based on another field. If my Code Reviewer State field is set to Requested I need the Code Reviewer Name to be required. I am using a validator scripted field. When I custom script validator it is always allowing the transition. If I use simple scripted validator it does not allow the transition even if both fields are populated. What am I missing?
TIA
Jenifer
FormField pro = getFieldByName("Code Reviewer State") FormField ecp = getFieldById("Code Reviewer Name") String vpro = (String) pro.getFormValue() String vecp = (String) ecp.getFormValue() if (vpro == "Requested") { ecp.setRequired(true) }else{ ecp.setRequired(false) }
Community moderators have prevented the ability to post new answers.
Converting Jamie's comment to answer so that this question shows as answered:
cfValues['Product Development']?.value != 'Yes' || cfValues['Done Environment']
That will make Done Environment required if Prod Dev is set to Yes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
cfValues['Product Development']?.value != 'Yes' || cfValues['Done Environment'] That will make Done Environment required if Prod Dev is set to Yes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I also tried this in the condition for a simple script: cfValues['Product Development']?.value == 'Yes' && cfValues['Done Environment']?.value == ' '
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, finally got back to this. This is what I have but it is still not working. Any help would be appreciated. import com.atlassian.jira.issue.Issue import com.opensymphony.workflow.InvalidInputException Issue myIssue = issue; if ((cfValue['Product Development'] == "Yes") && ((cfValues['Done Environment'] == " ")) { invalidInputException = new InvalidInputException("Done Environment is required"); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ugh, sorry. I will have to try to to write something. I am not a coder, usually just try to find something close and adjust it. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The code that you have there is for behaviours... but you mention script fields and validators. The simplest way to do this is with a "simple scripted validator" - what is the code you have for that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.