Hello! The situation is this: I need to output the selected string value from the child's drop-down list to another field. here is the code
<code>
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.customfields.view.CustomFieldParams
import com.atlassian.jira.issue.customfields.option.Option
import com.atlassian.jira.issue.customfields.view.CustomFieldParams
import com.atlassian.jira.issue.customfields.impl.CascadingSelectCFType
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.Issue
def IssueManager issueManager = ComponentAccessor.getIssueManager();
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfNFeed = customFieldManager.getCustomFieldObject('customfield_12404')
def direction = issue.getCustomFieldValue(cfNFeed)
def v_bus_direction = direction.split(';')[0]
def bus_direction = v_bus_direction.split(':')[1]
def v_work_direction = direction.split(';')[1]
def work_direction = v_work_direction.split(':')[1]
def v_type_work = direction.split(';')[2]
def type_work = v_type_work.split(':')[1]
String parent_new_value = bus_direction.toString() + ": " + work_direction.toString()
String children_new_value = type_work.toString() - "]"
def changeHolder = new DefaultIssueChangeHolder()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11117")
def fieldConfig = customField.getRelevantConfig(issue)
def parentOption = ComponentAccessor.getOptionsManager().getOptions(fieldConfig)?.find { it.toString() == parent_new_value }
def childOption = ComponentAccessor.getOptionsManager().findByParentId(parentOption.optionId)?.find { children_new_value }
def newValue = [:]
newValue.put(null, parentOption)
newValue.put("1", childOption)
customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), newValue),changeHolder)
</>
All i need is to transfer
children_new_value
to view here
newValue.put("1", childOption)
thanks!
Hello there,
Please feel free to share with us your solution so that it can help other users in the future!
Regards,
Shannon
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.