10

I have gone through some examples of using Remote Objects: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_remote_objects.htm

I haven't used it in my daily projects. My question is: why should I use it? Is there any benefits of doing so? The same functionality can be achieved by using Javascript remoting or actionFunction. And it does seem to me (I might be wrong) the code of remote objects is less readable.

Based on my understanding, it should be ajax calls, so the responding time can be a bit faster than actionfunction. But should be almost same thing as remote action. And the loading time might not be better.

Can someone explain the benefits of using that?

12

The benefit of Remote Objects is that you can access server data without using API calls or writing Apex Code. It's slower than the AJAX toolkit and the RemoteAction annotation (see this question), but does reduce the amount of Apex Code you have to write/maintain/unit-test, and, like RemoteAction, gives you access to data without using API calls. This allows Professional Edition to write functional JavaScript-based Visualforce pages, since they don't get Apex Code or API calls.

2
  • 3
    Thank you. Especially the Professional Edition does make sense to me.
    – Lance Shi
    Jan 9 '17 at 0:20
  • @LanceShi Yeah, I've never used it outside of SFSE, but it's useful to remember this if you were ever faced with developing for a PE client.
    – sfdcfox
    Jan 9 '17 at 0:24
7

Apart from the advantages listed in the previous answer ,The other advantage is the CRUD/FLS is automatically taken care in case of Remote Objects if you are thinking about ISV apps .

Normally in apex you will need to write extra code to respect CRUD/FLS .

However the other biggest drawback is handling namespaces .The namespace is hard coded in the mark-up which can be a hasle if you are building in teams and using continuous integration and want to maintain namespace free code .

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.