Posts Tagged ‘teknopoint’

Time Zone issue with Salesforce toolkit for Flex

November 1, 2010

Use Case for GMT +5:30

If a date is saved having the time HH hours and minutes between 0 to 29, the force-flex.swc toolkit serializes this date with time zone offset having additional 1 hour difference. So the date saved in the database will have one hour difference than actual date sent. This is because the logic written in Util.as class of the toolkit is not considering the difference between UTC and local time when the difference in minutes is negative. So the resultant time zone has additional 1 hour offset.

Consider the following case:

A date passed to the dateTimeToString function in Utis.as class in the toolkit is 16/02/2010 (mm/dd/yyyy format) and time 16 hours and 15 minutes.(Note the date specified is for GMT +5:30)

Date sent to Salesforce

The date after conversion is as shown in the soap message taken from httpfox tool of Mozilla firefox.

As seen from the soap message, the StartDateTime has the time zone set as +06:30 which is not the expected time zone.

Why this happens?

Consider the time for given date. Its 16 hours and 15 minutes.  When calculating time zone difference, the code in dateTimeToString function in Utis.as neglects the negative difference between the minutes. When the user enters 16 hours and 15 minutes, it will be 10 hours and 45 minutes in GMT(UTC). But during calculation what is happening is the difference between the hours and minutes is directly considered as time zone offset which in this case will be 6 hours (16 – 10) and -30 minutes        (15 – 45). As the –ve sign for minutes difference is neglected, it is reflected as 1 hour additional difference in calculated hour for time zone.

Fix for the Bug

To fix the bug, just put a check in Util.as class in the function dateTimeToString as shown below:

Time Zone issue Fix

I hope someone will find this helpful as I spent 2 whole days figuring out what the problem was.

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.

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 🙂

Learn Flex from Champions for Free !!

September 6, 2010

Adobe Flex is picking pace and is reaching a more organic level viz. the student community in India, and rightly so. If the next generation of engineers come equipped with knowledge for technologies like Flex, ColdFusion, Silverlight, Scala etc it will give Indian IT a new high.

There are lot of initiatives that are going on currently to spread Flex around. Like Adobe’s Flex@Campus which gives educational organization across India to leverage a free 1 day training on Adobe Flex. The flex community in India has extended its support to it. Because it is a hands on program, it gives you a head start into the technology allowing you to create a base on which you can build up.

Then there is RIA Connect. It is a Tekno Point initiative that is not restricted to Flex alone. It could me on any Adobe Product like Photoshop, Illustrator, Flash Professional, Flex, ColdFusion. It is a 1 day program for corporates, educational institutes or any other organization allowing them to understand the underlying abilities of the Technology and a follow up hands on session to get them started. The contents of this one day workshop are modified keeping the audience in mind. For Designers/ Devs there is more of  hands on and for business heads, architects there is more breadth in which the workshop topics are covered.

Don’t wait to get started. Go to the links and fill the forms to take your first step, as common sense says “To reach anywhere, you have to start from the beginning and go through the middle”

Installing flex sdk 3.2 or higher

May 30, 2009

Download latest Flex SDK (It will be a zip file)
Shut down Flex Builder 
(Take Backup and) Delete the license.properties file at:  C:\Documents and Settings\All Users\Application Data\Adobe\Flex\license.properties
Extract the files at <FB3-install-dir>\sdk (Typically C:\Program files\Adobe\Flex Builder\…)
Start Flex Builder again -> This time it will prompt for a license key, if not prompted to enter the license information at startup, use Help -> Manage Flex Licensesput the  license key.
Datavisualization source files will be extracted

Flex problem: ArgumentError: Error #1063

May 30, 2009

If you are getting this error while using RSL
ArgumentError: Error #1063: Argument count mismatch on mx.core::CrossDomainRSLItem(). Expected 5, got 6.
Make sure your applications are compiles using a consistent verions of sdkIn this case the application  (which uses the remote library) needs to be compiled with flex sdk  version 3.2 or higher

Why Adobe Flex – A developers perspective

May 30, 2009

Due to lack of knowledge about RIA’s there is a common concern of most fresh pass-outs and Engg. Student. I am trying to address the most common question I face:”Why Should I start my career with Adobe Flex?”

Apart from it being the hottest technology around I think the following 2 points sum up my argument 

Keeping it short and simple: I think there are 2 distinct reasons why a fresh graduate should pick up a technology like Flex over Java or .Net or any other legacy technologies.
1. The world is moving towards Rich UI and everyone wants to make it simple.  A lot of efforts are being put on the way user interacts with the system than say around 5 years ago for a simple fact that you want a lot more users to be able to use the system without having to be technically trained on the same. With this changing trend the newer generation developer has to be well versed so as to start their career from a higher point.
2. The amount of competition that a technology like Java/.Net brings up is tremendous. It will take too much time and effort to move up the ladder because of no. of available resources and the experience levels.  Whereas, a technology like Flex which is fairly newer gives a fair chance to a B.E. who is about to start his career along with those working on other technologies for some time.
Also with this as the bend towards creating applications at a very rapid pace to gain the first movers and situation advantage is really important e.g. During world-cup people might want to create application that allows user to track progress of each team and can be hot property around that time. However, once the world cup is over the same app is of little or no use at all. Thus the concept of rapid development. Flex has a suite of components which, if used correctly can really quicken the rate at which applications are created.
Overall I think, If I had to start my career I would rather start it with an RIA technology than any other.
Cheers,

Y


%d bloggers like this: