2

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,

2
  • Based on your other answer, I have faith that using variables in remoteobjectmodel WHERE clause is feasible. As such, my plan is to add a custom controller to my visualforce page, then add input fields to the page and use my custom controller to override the retrieve() operation. The overrided retrieve() method will merge the values from the users' input selections into the WHERE clause within the custom controller's retrieve() override method. Sep 16, 2017 at 19:34
  • hey @sfdcfox! i added my code and updated the question. I'm very appreciative of your expertise here. Sep 17, 2017 at 3:36

0

You must log in to answer this question.