Visualforce Remote object – I’m single
Following are two main parts of VF Remote object
Here is the single visualforce page(GitHub), that will display all the contact records from your org, you can search contact based on name, edit or delete the contacts records without writing single line of apex code or any API call.
Below is the code which will retrieve the records on the remote object, let look into that in detail. First we have to instantiate the remote object. This is common for all our DML operation method. ‘cont’ is jsShorthand for our remote object Contact.
retrieve() method on the remote object instance will fetch the records. This method accepts two arguments Criteria(where conditions) and Callback function(we need to process the retrieved records either to store or display in the page)
The Create() method on remote object instances will allow us to insert new records.Field values are set by passing in a JSON string with values for the fields to set on the new model
For updating the record call update() method and for deleting record call del() method, the logic remains same for passing the values where we need to pass ID of the record on which we need to perform update operation.