User Tools

Site Tools


validators

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
validators [2018/05/08 07:14]
root added more complex check
validators [2019/02/13 09:10] (current)
root added cascading drop down
Line 238: Line 238:
 </code> </code>
  
 +=== Check if cascading child drop down is set to "None" ===
 +The following script was found on Atlassian community here: [[https://community.atlassian.com/t5/Jira-questions/How-to-check-the-second-value-of-a-cascading-select-list-in-a/qaq-p/759808|How to check the second value of a cascading select list in a custom field]]
 +Use the **Custom Validator** for this script-runner script.
 +<code java>
 +import com.atlassian.jira.component.ComponentAccessor
 +import com.atlassian.jira.issue.MutableIssue
 +import com.opensymphony.workflow.InvalidInputException
 +
 +def issue = issue as MutableIssue
 +def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("CascadingSelect")
 +def cfValue = issue.getCustomFieldValue(cf) as HashMap
 +
 +def parentOption = cfValue.values().getAt(0)?.value
 +def childOption = cfValue.values().getAt(1)?.value
 +
 +if (!childOption) {
 +    throw new InvalidInputException("Child option is Null")
 +}
 +</code>
validators.1525778069.txt.gz ยท Last modified: 2018/05/08 07:14 by root