I've tried using an AND condition in my remote object. I keep getting an error. Here is what I have based on a help article. It works when there is only a single condition. Once I add two it doesn't work.

// On my VF page
// <apex:remoteObjects >
//    <apex:remoteObjectModel name="Group" fields="Id,Name" />
// </apex:remoteObjects>

    var queue = new SObjectModel.Group();
    var criteria = {
                    where: {
                      Name: {like: event.target.value +'%'},
                      Type: {eq: 'Queue'}
    queue.retrieve( criteria, function(err, records, event) {
      if (err) {
      var records = event.result.records;
  • What error are you getting? – sfdcfox Feb 12 '17 at 23:55

I presume you're getting the following error:

Invalid criteria specified for retrieval. ValidationError [code=11, message=Data does not match any schemas from "oneOf", path=/where, schemaKey=null]

You can only specify fields to filter if they are specified as part of the remoteObjectModel. You need to change your code as follows:

<apex:remoteObjects >
   <apex:remoteObjectModel name="Group" fields="Id,Name,Type" />

As a side note, it's not necessary to assign event.target.records to a variable; that's what the records variable returns anyways.

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.