You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi.]
I want to create a condition script to validate if a cascading field are filled.
Following my simple code. if is true a linked issue will be created using scriptrunner
if (cfValues['Dpt']?.values()*.value == [null, null])
{
return true
}
But it have an error.
Here is a groovy code:
In this case, if the cascading field is empty return false if the field has value in both of the fields - then return true
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.customfields.impl.CascadingSelectCFType
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def customFieldValue = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Cascading field name"));
HashMap<String, Option> hashMapEntries = (HashMap<String, Option>) customFieldValue
if(customFieldValue != null){
Option parent = hashMapEntries.get(CascadingSelectCFType.PARENT_KEY)
Option child = hashMapEntries.get(CascadingSelectCFType.CHILD_KEY)
if(parent == null || child == null){
return false
}else{
return true
}
}else{
return false
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.