Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hey guys,
I'm not really a developer, but I have a requirement for a create issue screen that I would like to implement.
Unfortunately I could not find anything suitable on the www.
in the create issue screen i have a custom field (cascading select list) with the following values.
parentid:
- one time
- Every day
- weekly
- per month
childid:
- Set up archiving
- Task file transfer set up
i want to make some work easier for the user.
if selection parentid:
{"daily or" weekly "or" monthly"}
then childid:
{"Set up task file transfer"}
so the user has a predefined selection of the most frequently occurring value. however, he can change it manually
I hope you can help me
seems i found a solution:
// Write this behavior on field Archivierungsdauer(Cascading Select List field)
import com.atlassian.jira.component.ComponentAccessor
def crField = getFieldById(getFieldChanged())
def selectedOption = crField.getValue() as String
// det the cascading select field
def fieldName = "Archivierungsdauer"
//Parent value you want to select (Cascade select list) parent)
def parent1 = "einmalig"
def parent2 = "täglich"
def parent3 = "wöchentlich"
def parent4 = "monatlich"
// child value that you want to select (Cascade select list child)
def child1 = "Archivierung einrichten"
def child2 = "Zusätzlichen FBIA Task Filetransfer einrichten"
//Get Cascade select List field
def field = getFieldByName(fieldName)
def optionsManager = ComponentAccessor.getOptionsManager()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName(fieldName)
def fieldConfig = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(fieldConfig)
// Select the value of form field value (Select list field)
if (selectedOption.contains("einmalig"))
{
//Set einmalig default values
def parentOption = options.find {it.value == parent1}
def childOption = parentOption?.childOptions?.find {it.value == child1}
field.setFormValue([
parentOption.optionId,
childOption.optionId
])
}
else if (selectedOption.contains("täglich"))
{
//Set täglich default values
def parentOption = options.find {it.value == parent2}
def childOption = parentOption?.childOptions?.find {it.value == child2}
field.setFormValue([
parentOption.optionId,
childOption.optionId
])
}
else if (selectedOption.contains("wöchentlich"))
{
//Set wöchentlich default values
def parentOption = options.find {it.value == parent3}
def childOption = parentOption?.childOptions?.find {it.value == child2}
field.setFormValue([
parentOption.optionId,
childOption.optionId
])
}
else if (selectedOption.contains("monatlich"))
{
//Set monatlich default values
def parentOption = options.find {it.value == parent4}
def childOption = parentOption?.childOptions?.find {it.value == child2}
field.setFormValue([
parentOption.optionId,
childOption.optionId
])
}
else {
return
}
if i start create issue the first lection af a parrent value and autom. set the child value works..
BUT:
if ich change the parrent value to another, both values are changing the value continuously.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.