0

I've seen Backbone.Force and force.entity.js and both use ForceTK.

However, it looks like ForceTK just uses the REST API. Is there a similar library that transparently integrates Backbone.js with VisualForce Remote Objects instead of using the REST API (which consumes API calls against your limit)?

It seems fairly trivial to build this, but I just don't want to re-invent the wheel in case this has already been done. I can't seem to find anything though.

How will this be used?

We're using mostly default layouts and views for most objects now and want to rebuild optimized custom views and workflows, while leveraging our team's existing Backbone Marionette skills. A lot of our Salesforce code is rarely touched outside big changes, so using a familiar technology makes more sense.

Goals

  • Don't consume API limits (unlike REST)
  • Fast prototyping

    It's great to add more functionality in JS without needing a lot of changes to support them. REST seems the best here, but uses API calls. VF Remote Objects still requires VF boilerplate, but it's minimal. Using JavaScript Remoting won't count against API call limits either, but requires a bit of Apex boilerplate for basic CRUD operations.

  • Best possible performance and data consistency

    Not specific to VisualForce Remote Objects, but the app will eventually need to be as fast as possible and do multi-object changes transactionally. Maybe this means I'll end up writing a @RemoteAction with custom SOQL when I need to get nested objects in a single round trip or if I need to save all those objects at once, transactionally.

    For complex multi-object scenarios, add CRUD would need to be re-implemented with a RemoteAction override anyways, but VisualForce Remote Objects still seems convenient for simpler single-object scenarios.

  • 2
    ForceTK allows you to build your app in js on the client. VF Remote Objects requires that you write VF code (on the server). From there, you can layer your own js API on top of that, but it's not going to be a pure client side solution. – Robert Sussland Dec 9 '16 at 23:13
  • Understood on how this works. I'm wondering if somebody's written a layer that works with VF Remote Objects just as ForceTK works with the REST API. Similarly to ForceTK, you'd need a initialize a few variables on page load, and this app would have to be on a VF page with a couple lines of setup, but the layer / library I'm imaging would otherwise leave all the rest of the application logic to Backbone. Maybe nobody's taken this on yet, but ideally the layer is so transparent, you could switch from ForceTK to a Remote Object based approach with only a few code changes. – jon_wu Dec 10 '16 at 3:54
  • It's not a matter of a few global variables. For every object and every field you want to access, you'd need to write server-side VF code for that object/field as well as define the js function it's exposed as in VF. So given that the full data model and bindings needs to be specified on the server, it's not really the same experience as programming in backbone and setting up some globals on the server. For example, you can't make general SOQL queries. If you change which field you query, you'd need to make a server side change as well, which is very different from REST API. – Robert Sussland Dec 11 '16 at 5:01
  • I agree, the workflow wouldn't be quite as easy since you'd have to get the VF page set up for each object, but for me the list is pretty finite. If manual management became a hassle, there could just be a code generation step from JS to create the boilerplate VF with the desired fields. I'll also need JS Remoting for transactional nested object updates or 1 round trip nested queries. The need to create the right VF up front seems like a burdensome requirement of using VF Remote Objects. I wonder why not just make REST free from VF? Perhaps only using REST and Remoting is easier to manage. – jon_wu Dec 11 '16 at 20:45
  • I updated the question with more context about why I thought VF Remote Objects might be the best (mainly not impacting API call limits). However, given that many of my views may use JS Remoting after they're prototyped (see last goal about performance and consistency), I wonder if VF Remoting may just add necessary complexity. It'd still be nice to do basic CRUD for 'free', but API calls are pretty cheap vs the cost of development complexity. – jon_wu Dec 11 '16 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.