With the FDS 2.01 upgrade the Flex Data Services CRM Example Application will not work. Ths Adobe Devnet article demonstrates FDS data retrieval with ColdFusion. The main application file, companyapp.mxml, will no longer compile.

view plain print about
11 Error found.
2
3Error /cfcrm/companyapp.mxml:256
4Implicit coercion of a value with static type Object to a possibly unrelated type String.<br/><br/>255:     <mx:Binding source="zip.text" destination="company.zip"/>
5256:     <mx:Binding source="companyIndustryCombo.selectedItem" destination="company.industry"/>
6257:


This CRM example has a panel with datagrid on the left which lists companies, and the same view has a detail panel on the right where company information can be entered or updated, as well as an employees tab where employees per company can be added, updated, or removed.

When the application loads the company detail panel on the right has a combobox for Company Industry, which itself has a binding to the industry property in the Company class for the currently viewed company.

Flex CRM App

The error shown above is in the mx:Binding tag on line 256. It regards the conversion of an Object, companyIndustryCombo.selectedItem, to a String, company.industry. Flex 2.0 must have silently performed this downcasting automatically since the error above did not occur in Flex 2.0, but does occur with 2.01.

The combobox on lines 325-328 is written as:

view plain print about
1<mx:FormItem label="Industry">
2     <mx:ComboBox id="companyIndustryCombo" dataProvider="{companyIndustries}"
3        selectedItem="{company.industry}" width="250"/
>

4 </mx:FormItem>


The company Class samples.crm.Company defines the properties associated with each instance of a company object, and the original application shows that the industry property is of type String:

view plain print about
1package samples.crm
2{
3import mx.collections.ArrayCollection;
4    [Managed]
5    [RemoteClass(alias="samples.crm.Company")]
6    public class Company
7    {
8        public var companyId:int;<br/><br/>        public var name:String = "";<br/><br/>        public var address:String = "";<br/><br/>        public var city:String = "";<br/><br/>        public var state:String = "";<br/><br/>        public var zip:String = "";<br/><br/>        public var industry:String = "";
9        
10        public function Company()
11        {
12        }
13    }
14}


To correct this I tried various ways to narrow or downcast the combobox selected item to String, but didn't get that to work. I was also unsuccessful when I tried changing the mx:Binding for the source to be companyIndustryCombo.selectedItem.industry. Those changes allowed the mxml file to compile without error, but it broke the binding so changing the selected item in the combobox would not automatically change the corresponding field on the left master panel, which it should.

The only viable solution I found was to upcast or widen the industry property from String to Object. On line 31 of samples.crm.Company.as I changed
view plain print about
1public var industry:String = "";
to
view plain print about
1public var industry:Object = "";