Not sure why this didn’t occur to me when I first start developing with JavaScript Remoting, but it took Dave Carroll asking how I thought Flex would work with the feature before I started to put an example together.  I’ve finished adding that example to the HTML5 package from the earlier post and I have to say, it is a pretty impressive combination.  If you’re used to developing with Flex on, you’ve probably grown to love the Flex toolkit – and there is a lot to love about that toolkit.  However, if all you need to develop is, for example, some simple charts embedded in a Visualforce page, then handling the login/sessionID and SOAP callouts may be a bit of overkill.  And you’re using API calls for every transaction as well.

With JavaScript Remoting, you can have ActionScript as simple as this:

Screen shot 2011-06-17 at 1.07.40 PM

Communicating with JavaScript as simple as this:

Screen shot 2011-06-17 at 1.07.52 PM

And start viewing charts which look like this:

Screen shot 2011-06-17 at 1.09.10 PM
It’s fast, easy and extremely platform friendly.  It will behave from a user point of view just like Apex and Visualforce normally does and requires no API access.  While creating more robust or mobile applications may be a job for the toolkit or the Flex REST kit, if you are embedding Flex into Visualforce … I would highly recommend looking JavaScript Remoting first.  As mentioned, I’ve added this to the HTML5 Example Package (even though technically this isn’t using any HTML5) for perusal, and will either be adding it to the git project and or adding a new one.

Questions?  Comment below, or as usual catch me on twitter @joshbirk.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS