Behind the scenes of Remote Objects, the basic operations—create(), retrieve(), update(), and del()—use a Remote Objects controller that’s the equivalent of the standard controller for normal Visualforce pages. You can override Remote Objects operations to extend or replace the built-in behavior of this controller. Overrides of Remote Objects operations are written in Apex and take effect by adding them to your page’s Remote Objects definitions.
<apex:remoteObjectModel name="Contact" fields="FirstName,LastName,Phone" create="{!$RemoteAction.RemoteObjectContactOverride.create}"/>
The attribute takes a Visualforce expression that references the @RemoteAction method to use as the override for the built-in create() operation. The expression takes the form of $RemoteAction.OverrideClassName.overrideMethodName, where the $RemoteAction global handles your organization namespace, as it does for JavaScript remoting. Note that the class that contains the @RemoteAction method needs to be set as the page’s controller or as a controller extension for the page.
With this declaration, whenever your page’s JavaScript code calls the create() function for a contact Remote Object, instead of using the Remote Objects controller, your remote method will be called.
Remote Objects override methods are written as @RemoteAction methods in an Apex class, which you add to your page as a controller or controller extension.
@RemoteAction public static Map<String,Object> methodName(String type, Map<String,Object> fields)
The return value is a map that represents the result of a Remote Objects operation. This map typically include the results of the call, the status, and any custom data that you want to provide as part of your custom method.
@RemoteAction public static Map<String, Object> create(String type, Map<String, Object> fields) { Map<String, Object> result = RemoteObjectController.create(type, fields); return result; }