innovalog/jira-workflow-utilities-jar — pull request #1 by dmccormack (2012-06-26 15:07:22+00:00)
Title: Cascadingselect fix

Hi David,

My colleague Kai was talking to you in the following [ticket](https://studio.plugins.atlassian.com/browse/JMWE-79?focusedCommentId=60543&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-60543) regarding an issue with Cascading Selects.

I took a look through the source code and made some changes in *WorkflowUtils* that fixes the issue for us but it may have introduced other issues.

It can happen that the Object being passed into the method *setFieldValue* is null but its parent may contain values, so in line 409 I check if *newValue* is null and allow it to continue.

In the method *convertStringToOption* there was an issue where 2 or more parent objects could contain the same child values. The method was returning the first Option it found based on the child values, but this meant that parent option could be wrong. So I read the parent option from the issue and check against the list of options in the optionsmanager and return the option that is matched. If there are no options (from allowing the code to continue at 409) I check if there is a parent option in the issue and return the parent option if it exists.

In the check *cfType instanceof CascadingSelectCFType* on line 414 the code was originally calling *convertOptionToCustomFieldParamsImpl* but this was creating the wrong type of Object for passing to *customField.updateValue* on line 469, so I created a new method *convertValueToMap* with the relevant object.

We tested this against jia-5.0.4 and it works for us based on our use cases. Maybe you can check if this has introduced other issues for you?

Thanks
Declan