CloudKit.js: Querying for IN of Array of References

Howdy,


Let's say I've got an 'Order' record type and a 'Transaction' record type. Transaction has a reference to order.


I have an array of recordNames of orders and I want to get transactions that match any of the orders. Can I do this? I've been having trouble.


  var orderReferences = [];
  orderIdentifiers.forEach(function(orderIdentifier) {
    var orderReference = {
      recordName: orderIdentifier,
      action: "NONE"
    };

     orderReferences.push(orderReference);
  });


  var query = {
    recordType: "Transaction",
    filterBy: [{
      fieldName: 'order',
      comparator: 'IN',
      fieldValue: {
        value: orderReferences
      }
    }]
  };


(forgive my perhaps terrible JS - it's not a language I use a lot)


This doesn't work, I get an error back from the server saying it could not decode my reference (I assume because I'm trying to query with an array of references?)


How is this supposed to work?


Thanks!

Replies

Here's the server response to the above query:


{"uuid":"***","serverErrorCode":"BAD_REQUEST","reason":"could not decode reference object"}

While this is really old was this ever solved? I saw this error recently.

Did you ever figure this out? I have constructed a query just like this and it doesn't work.