Archive for October, 2010

INVALID_FIELD: No such column ‘type’ error in flex salesforce communication

October 29, 2010

While trying to pass a custom object in salesforce from Flex. If you encounter the below error. Especially if you are passing a wrapper class to the webservice method.

“INVALID_FIELD: No such column ‘type’ on entity . If you are attempting to use a custom field, be sure to append the ‘__c’ after the custom field name. Please reference your WSDL or the describe call for the appropriate names.”

This occurs because the flex salesforce toolkit forces a property type while creating request parameters to be serialized with salesforce.

There are 2 solutions to this: First the not so attractive one is to convert everything to wrapper classes and send all data as SObjects. This will add overhead on salesforce  side to manage the conversion of object.

Second, go to Salesforce flex toolkit and add a condition to the SObject class on line 101:

if(this["type"]){
this.writeValue(sobjectNs, writer, "type", this["type"]);
}

This should solve the issues of not being able to send the data to salesforce.

Advertisements

Flex Framework for SalesForce Apps- Part 4 Application

October 28, 2010

Now that we have seen the concepts, understood how flex and salesforce can talk to each other. Time to see an application build with this approach. You can download the application from here (Right click and select download linked file as..)

And the library Project from here.

For every call what needs to be done is very simple: Create a controller, add mapping and dispatch an event with bubble set to true.

Import the FXP and the FXPL into your flash builder and put the correct configuration in for salesforce  and your code should be working.

The responder handles the result or fault. RC4SF can be used with any existing framework like Mate or SWIZ. Personally I find code based configuration better than writing XML based configuration in my code and hence the approach. We intend to put all those things online as soon as we are able to breathe a bit out of our consulting assignments 😉 We ‘ll keep exploring and posting it here.

As I sign off  this series a small note. This is not a new framework. We have used this for a while not and almost all frameworks use the same principles. We have combined what we knew was the best and here one that suits us the best. Feel Free to Modify the source code or use any part that you think will be useful for your project.

Up next: Using Melrose: Putting AIR apps on the Intel AppStore and more 🙂


%d bloggers like this: