Mapping a Cascading Select List Option to Your Lookup Table
Scenario
I have a long list of options, which has multiple child options for the custom field used.
Based on User's selection, I want the lookup post function to return me a username based on the Platform selected.
How can I structure the lookup table for this custom field?
Pre-Requisite
- You have a cascading custom field. And this is how your cascading values are stored.
- Looking at your Jira issue, this is how the field populates (Parent: Jira, Child 7.9.X/7.8.X/7.7X)
Steps
Design of your Lookup String Value
e.g. {null=Parent, 1=Child}
Result on how your lookup the values is stored in your Lookup Table
Please look at "Action if No Records Matched" located in https://akeles.jira.com/wiki/spaces/LOOKUP/pages/45908023 and configure your preferred settings when no matching platforms is found in your post function.
Tips
Field type Storing Formats we have identified
Plugin Custom Field Type Format Example Jira Select List (cascading) {null=parent value, 1=child value} {null=jira, 1=7.9.x}
Dynamic Forms for Jira Deviniti [Dynamic Forms] - Dynamic Cascading Select {null=parent value, 1=child value} {null=jira, 1=7.9.x} Multi-Level Cascading Select Multi-Level Cascading Select [parent value, child value, grandchild value] [jira, 7.9.x, 4 ] - Finding your other option's value? Update your Lookup Table Row values based on how your Lookup String with any of the methods below.
View your parent and child values via a SQL query
CODESELECT cf.cfname "Field Name", cfo1.customvalue "Primary Option", cfo2.customvalue "Secondary Option", concat("{null=", cfo1.customvalue, ", 1=", cfo2.customvalue, "}") "Lookup String" FROM customfield cf, customfieldoption cfo1, customfieldoption cfo2 WHERE cfname = 'Platform Version/s' AND cf.id = cfo1.customfield AND cf.id = cfo2.customfield AND cfo1.parentoptionid is null AND cfo2.parentoptionid = cfo1.id
View your cascading field's value via a script (with ScriptRunner)
CODEimport com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.CustomFieldManager; import com.atlassian.jira.issue.fields.CustomField; import com.atlassian.jira.issue.fields.FieldManager; import org.apache.log4j.Level; import org.apache.log4j.Logger; Logger logger = Logger.getLogger("com.akeles.jira"); logger.setLevel(Level.DEBUG); CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager(); def issue = ComponentAccessor.getIssueManager().getIssueByCurrentKey("TESTPROJ-123") // the custom field id we are pulling is: 10901 CustomField cField = customFieldManager.getCustomFieldObject(10901L); String cFieldValue = (String) issue.getCustomFieldValue(cField); logger.debug("Custom field's value is = " + cFieldValue);