title: SalesForce query returns results in Query Editor, but returns null from APEX code in Lightning component
body: <p>I'm completely new to SalesForce and have inherited a report that's not working.  Please excuse any incorrect terminology, since I'm learning about all this as I go.  The report has three prompts: states, years, and members.  All dropdowns are supposed to populate with data returned from functions in an APEX class.  State, which populates from a picklist, and years, which is populated with a loop, work fine.  Members, which populates from a SQL query, returns nothing.  If I run the report without any prompts selected (which should return an unfiltered list of results from a SQL query), it also returns nothing.  Both of the SQL queries return data when I execute them directly in the query editor in the developer console, but they return nothing when called from the APEX functions.</p>
  <p>Here's the initialization code from the Lightning controller:</p>
  <pre><code>doInit: function (component, event, helper) {
          var action = component.get('c.getTrcAccounts');
          action.setCallback(this, function (response) {
              var state = response.getState();
              if (state === 'SUCCESS' &amp;&amp; component.isValid()) {
                  component.set('v.trcAccList', response.getReturnValue());
              }
              helper.getLocationState(component, event);
              helper.getYear(component, event);
          });
          $A.enqueueAction(action);
      },
  </code></pre>
  <p>Here are the two helper functions referenced in that code:</p>
  <pre><code>getLocationState: function (component, event) {
          var action = component.get('c.getLocationState');
          action.setCallback(this, function (response) {
              var state = response.getState();
              if (state === 'SUCCESS') {
                  component.set('v.LocationStateList', response.getReturnValue());
              }
          });
          $A.enqueueAction(action);
      },
      getYear: function (component, event) {
          var action = component.get('c.yearsOptions');
          action.setCallback(this, function (response) {
              var state = response.getState();
              if (state === 'SUCCESS') {
                  component.set('v.LocationYearList', response.getReturnValue());
              }
          });
          $A.enqueueAction(action);
      }
  </code></pre>
  <p>Here is the code from the APEX class that returns the data for those three prompts:</p>
  <pre><code>Global class DataTableLocations {
  @AuraEnabled
      Global static List&lt;TRC_Account__c&gt; getTrcAccounts(){
          set&lt;string&gt; trcAccountSet = new set&lt;string&gt;();
          List&lt;TRC_Account__c&gt; traccList = new List&lt;TRC_Account__c&gt;();
          for(TRC_Account__c trcacc : [SELECT Id, Name from TRC_Account__c WHERE TRC_Member__c = True order by Name limit 50000]){
              if(!trcAccountSet.contains(trcacc.Name)){
                  trcAccountSet.add(trcacc.Name);
                  traccList.add(trcacc);
              }
          }
          if(traccList.size()&gt;0){
              return traccList;
          }
          else{
              return null;
          }   
      }
      @AuraEnabled
      Global static List&lt;string&gt; getLocationState(){
          List&lt;string&gt; options = new List&lt;string&gt;();
          //options.add(new SelectOption('SelectAll', 'Select All'));
          for( Schema.PicklistEntry f : Location__c.Physical_Address_State__c.getDescribe().getPicklistValues()) {
              options.add(f.getValue());
          } 
          return options;
      }
      
      @AuraEnabled
      Global static List&lt;string&gt; yearsOptions() {
          List&lt;string&gt; options = new List&lt;string&gt;();
          date OldDate= date.today().addYears(-18);
          integer oldyear=OldDate.year();
          for( integer i=0; i&lt;19 ;i++) {
              options.add(string.valueOf(oldyear));
              oldyear++;
          } 
          return options;
      }
  }
  </code></pre>
  <p>If I run SELECT Id, Name from TRC_Account__c WHERE TRC_Member__c = True order by Name limit 50000 directly in the query editor window in the developer console, I get 7 results.  However, if I output the response.getReturnValue() for getTrcAccounts in the doInit function, it's null.</p>
  <p>Any help is greatly appreciated, as we're in a bit of a time crunch in conjunction with a site redesign. I'm told these reports were working at one point, but no one knows when they stopped working, and we inherited this code from a different company that did the original development.  Thank you!</p>
  <p>UPDATE:</p>
  <p>In case it helps, this is the code in the lightning app that I think is used on the public page:</p>
  <pre><code>&lt;aura:application extends=&quot;ltng:outApp&quot; access=&quot;GLOBAL&quot; implements=&quot;ltng:allowGuestAccess&quot;&gt;
      &lt;aura:dependency resource=&quot;c:SearchBinReceiptsByYear&quot;/&gt;
  &lt;/aura:application&gt;
  </code></pre>