2

I have a remote object on a custom object 'Cars__c'.

<apex:page >
<apex:remoteObjects >
    <apex:remoteObjectModel name="Car__c" jsShorthand="Cars" 
        fields="Name, Id">
        <apex:remoteObjectField name="Doors__c" jsShorthand="Doors"/>
        <apex:remoteObjectField name="Price__c" jsShorthand="Price"/>
        <apex:remoteObjectField name="Engine_size__c" jsShorthand="Engine"></apex:remoteObjectField>
    </apex:remoteObjectModel>
</apex:remoteObjects>

<script>
    var getCarsInfo = function(){
        var c = new SObjectModel.Cars();

        c.retrieve({
            where: {
                Engine: {eq: null} // Remote object query criteria. The question problem
            } 
        }, 
        function(err, records, event){
            if(err) {
                alert(err.message);
            }
            else {
                var ul = document.getElementById("carsList");
                records.forEach(function(record) {

                    var cText = record.get("Name");
                    cText += " -- ";
                    cText += record.get("Doors");
                    cText += " -- ";
                    cText += record.get("Price");
                    cText += " -- ";
                    cText += record.get("Engine");

                    var li = document.createElement("li");
                    li.appendChild(document.createTextNode(cText));
                    ul.appendChild(li);
                });
            }
        });
    };
</script>
<h1>Retrieve Cars via Remote Objects</h1>
<p>Cars:</p>
<ul id="carsList">
</ul>
<button onclick="getCarsInfo()">Retrieve Cars</button>

My custom object Car__c has the following custom fields (and types): Doors__c(Number), Engine_size__c (Number) and Price__c (Currency).

In my case, I want to show cars objects, inserted with no engine size (engine size undefined), but what I get is an alert by the query:

Retrieval error

This happens even if I set

Engine: {eq: undefined}

or

Engine: {eq: ''}

and for the Price field, that is a currency type.

What is the right way to select undefined value for Engine or Price?

UPDATED: The text of the error is:

Error occurred while performing RETRIEVE operation on sobject: Car__c with data: {where={Engine_size__c={eq=null}}} (INVALID_FIELD: Doors__c, Name FROM Car__c WHERE Engine_size__c = 'null' LIMIT 20 ^ERROR at Row:1:Column:67value of filter criterion for field 'Engine_size__c' must be of type double and should not be enclosed in quotes)

  • Can you please include the error message as text instead of an image? – Adrian Larson Apr 7 '17 at 14:13
  • @AdrianLarson updated question! – Franktrt Apr 7 '17 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.