You need to sign in to do that
Don't have an account?
ying liu
error about retrieve records in VF remote objects with lookup fields
I have created a VF with some remote objects.
I want to retrieve records from those objects with lookup fields.
But there is an error which is “Invalid criteria specified for retrieval. ValidationError [code=11, message=Data does not match any schemas from "oneOf", path=/where, schemaKey=null]".
Other fields can be queryed except for lookup.
Below is my code in VF.
var existAtt = new SObjectModel.ExistAttendee();
existAtt.retrieve({ where : {Account_vod__c: {eq: 'a0pK0000000XAYvIAO' }}}, function(err, records){
if(err) {
alert(err.message);
}else{alert("ok");}
});
Please help me about this!
Thanks much!
I want to retrieve records from those objects with lookup fields.
But there is an error which is “Invalid criteria specified for retrieval. ValidationError [code=11, message=Data does not match any schemas from "oneOf", path=/where, schemaKey=null]".
Other fields can be queryed except for lookup.
Below is my code in VF.
var existAtt = new SObjectModel.ExistAttendee();
existAtt.retrieve({ where : {Account_vod__c: {eq: 'a0pK0000000XAYvIAO' }}}, function(err, records){
if(err) {
alert(err.message);
}else{alert("ok");}
});
Please help me about this!
Thanks much!
I have found the reason and which is the query field must be in fields of remoteobjectmodel.
I added Account_vod__c to fields and it works.
<apex:remoteObjectModel name="Attendee_vod__c" jsShorthand="ExistAttendee" fields="Id,Name,Account_vod__c">
</apex:remoteObjectModel>
All Answers
seems you are trying to retrieve records for ExistAttendee (a custom object) , so you should have __c for the object name
var existAtt = new SObjectModel.ExistAttendee__C();
existAtt.retrieve({ where : {Account_vod__c: {eq: 'a0pK0000000XAYvIAO' }}}, function(err, records){
if(err) {
alert(err.message);
}else{alert("ok");}
});
Thanks for your answer.
ExistAttendee is an alias name about a custom object. And I am sure ExistAttendee is ok.
I have used remote object which is like this:
<apex:remoteObjectModel name="Attendee_vod__c" jsShorthand="ExistAttendee" fields="Id,Name">
</apex:remoteObjectModel>
The lookup field has to be called with Reference,
CurrentObject__r.LookupObject__c.RecordName
Regards,
Ashish
I have found the reason and which is the query field must be in fields of remoteobjectmodel.
I added Account_vod__c to fields and it works.
<apex:remoteObjectModel name="Attendee_vod__c" jsShorthand="ExistAttendee" fields="Id,Name,Account_vod__c">
</apex:remoteObjectModel>
But when querying:
the problem was the 'i' in IsLatest.