You need to sign in to do that
Don't have an account?
Paul Grice 20
apex SOQL returns empty list in SF1 (but works in Lightning Experience)
I am calling an SOQL query in an apex server class. It returns 2 records in the Lightning Experience in the browser but an empty list in Salesforce1 on the mobile. If I create and return a list it works, so it seems to be the query which is the problem. The user is the same in both instances. (I'm also not really sure how to generate a debug log for mobile.)
APEX controller
APEX controller
public with sharing class TaskController { @AuraEnabled public static List<Task> getTasksforContact(String id) { List<Task> t = new List <Task>(); t = [ SELECT Id FROM Task WHERE WhoId = '0035B000008mEwa' ]; // test /* Task t2 = new Task(WhoId = '0035B000008mEwa', Subject = 'Test'); List<Task> t = new List<Task>(); t.add(t2); */ return t; }Client Controller
({ doInit : function(cmp) { var action = cmp.get ("c.getTasksforContact"); var theId = cmp.get("v.contactId"); theId = "0035B000008mEwa"; // testing action.setParams ({ id : theId }); action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var retVal = response.getReturnValue(); cmp.set ("v.tasks", retVal); var t = cmp.get("v.tasks"); } else console.log("State is NOT Success!"); }); $A.enqueueAction(action); } })Client Component
<aura:component controller="TaskController" implements="flexipage:availableForAllPageTypes" > <aura:attribute name="contact" type="Contact" /> <aura:attribute name="contactId" type="String" /> <aura:attribute name="leadId" type="String" /> <aura:attribute name="tasks" type="Task[]"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <aura:method name="refresh" action="{!c.doInit}" /> <aura:iteration items="{!v.tasks}" var="task"> Subitem<br /> {!task.Id}<br /> {!task.Subject}<br /> </aura:iteration> </aura:component>
The contact page overloading is done through Setup > Customise . Contacts > Buttons, Links and Actions > View/Edit.