Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Retrieving Records with

Retrieve records by calling retrieve() on a Remote Objects model instance.
retrieve() requires two arguments, one for query criteria and one for a callback handler.
1RemoteObjectModel.retrieve({criteria}, callback_function)
criteria can be a Remote Objects query object or a function that returns one. The following two calls are equivalent.
1var ct = new RemoteObjectModel();
2
3// Empty callback functions for simplicity
4ct.retrieve({where: {FirstName: {eq: 'Marc' }}}, function() {}); // query object
5
6ct.retrieve(function(){
7	return({where: {FirstName: {eq: 'Marc' }}});
8}, function() {}); // function returning query object
See Format and Options for Visualforce Remote Objects Query Criteria for an explanation of the query object.
retrieve() doesn’t return a result directly. The callback function enables you to handle the server response asynchronously.

All server operations that use Remote Objects are performed asynchronously. Any code that depends on the request being completed, including handling returned results, must be placed in the callback function.

Note

Your callback function can accept up to three arguments.
1function callback(Error error, Array results, Object event) { // ... }
See Visualforce Remote Objects Callback Functions for details about writing Remote Objects callback functions.

To retrieve records using dates, pass in the JavaScript date object to the query.

1var myDate = new Date('2017-01-20');
2ct.retrieve({where: {CloseDate: {eq: myDate}}}, function() {});