See my code comments in my controller for what I'm trying to do. This article might help as well: Overriding Default Remote Objects Operations
Page
<apex:page>
<apex:remoteObjects >
<apex:remoteObjectsjsNamespace="RemoteObjectModel">
<apex:remoteObjectModel name="Opportunity" fields="Id,isWon"/>
</apex:remoteObjects>
<script>
var opp = new RemoteObjectModel.Opportunity();
opp.retrieve(
{ where: {
isWon: {eq: FALSE}
},
orderby: [ {Id: 'ASC'} ],
limit: 1 },
function(err, records) {
if (err) {
alert(err);
} else {
console.log(records.length);
console.log(records[0]);
}
}
);
</script>
</apex:page>
Controller:
public class overrideRemoteObjectOperations{
@RemoteAction
public static Map<String,Object> retrieve (String type, Map<String,Object> fields){
//My goal in this controller is to eliminate the hardcoding of FALSE in the visualforce page, see 'isWon: {eq: FALSE}'
//and replace by a boolean value that the user selects on the page.
}
}
Any examples? Thank you,