You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.
Join groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I have a dropdown by name Domain which has values domainA, domainB, domainC.
for each value of domain, for example domainA has child with options component1, component2.
Schema info:
"customfield_10110": {
"required": true,
"schema": {
"type": "option-with-child",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:cascadingselect",
"customId": 10110
},
"name": "Domain",
"hasDefaultValue": false,
"operations": [
"set"
],
"allowedValues": [
{
"self": "https:/rest/api/2/customFieldOption/10009",
"value": "domainA",
"id": "10009",
"children": [
{
"self": "https:/rest/api/2/customFieldOption/10042",
"value": "Component1",
"id": "10042"
}
]
}
]
}
During the rest call to create issue, i am unable to map value of child to parent using java code.
i am using below code to map value of child to parent but its not working. can anyone suggest a way to do it.
IssueInputBuilder issueBuilder = new IssueInputBuilder(projectKey, issueTypeID);
if (fieldID.equals("customfield_10110") && issueField.isRequired()) {
try {
// Get allowed value for the required field
String allowedValue = null;
for (Object object : issueField.getAllowedValues()) {
if (object instanceof CustomFieldOption) {
CustomFieldOption cfo = (CustomFieldOption) object;
allowedValue = cfo.getValue();
String id = String.valueOf(cfo.getId());
//set domain name
if(allowedValue.equalsIgnoreCase("domainA")) {
ComplexIssueInputFieldValue domain = getComplexIssueInputFieldValue(allowedValue,id);
issueBuilder.setFieldValue(fieldID, domain);
//set application name
Iterable<CustomFieldOption> child = cfo.getChildren();
Iterator itr = child.iterator();
while(itr.hasNext()) {
CustomFieldOption childField =(CustomFieldOption) itr.next();
String childValue=childField.getValue();
if(childValue.equalsIgnoreCase("Component1")) {
String childKey = String.valueOf(childField.getId());
ComplexIssueInputFieldValue app = getComplexIssueInputFieldValue(childValue,childKey);
issueBuilder.setFieldValue("customfield_10110", app);
break;
}
}
}
}
}
} catch (Exception ex) {
// Does not have allowed value
issueBuilder.setFieldValue(fieldID, "Test");
}
}
Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events