So I am working to create a VF page that pulls a list of records from a custom object (Individual_Account__c) and I am also trying to filter this list of records based on a cross-object formula field (Current_Year__c) which is a checkbox. I only want the list to pull records that are "true". Here is the code I have:
<apex:remoteObjects >
<apex:remoteObjectModel name="Individual_Account__c" fields="Id,Name,LastModifiedDate,Current_Year__c"/>
</apex:remoteObjects>
<div class="mypage">
<h2>Individual Accounts</h2>
<ul id="accountList"/>
</div>
<script>
var ul = document.getElementById("accountList");
var account = new SObjectModel.Individual_Account__c();
account.retrieve(
{where: {
Current_Year__c: {eq: 'true'}}
},
{orderby: [{LastModifiedDate: 'DESC'}], limit: 15},
function(error, records) {
if (error) {
alert(error.message);
} else {
var html = "";
records.forEach(function(record) {
html = html + "<li><a data-id=" + record.get("Id") + ">" +
record.get("Name") + "</a></li>";
});
ul.innerHTML = html;
}
}
);
ul.addEventListener("click", function(e) {
sforce.one.navigateToSObject(e.target.getAttribute("data-id"));
});
</script>
</apex:page>
Everything works with this code except for when I insert this line:
{where: {
Current_Year__c: {eq: 'true'}}},
Any idea what the issue?
Thanks!