I have been trying to implement a custom search in communities whereby the user can type in the first line of the address and the search will update with each keystroke. But I receive this error:

Action failed: c$ContactList$controller$searchKeyChange [Cannot read property 'setParams' of null] Failing descriptor: {c$ContactList$controller$searchKeyChange}

The code in question is below.


<aura:component controller="ContactListController">

<aura:attribute name="accounts" type="account[]"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:handler event="c:SearchKeyChange" action="{!c.searchKeyChange}"/>

    <aura:iteration items="{!v.accounts}" var="account">
            <a href="{! '#/sObject/' + account.Id + '/view'}">


doInit : function(component, event) {
    var action = component.get("c.findAll");
    action.setCallback(this, function(a) {
        component.set("v.accounts", a.getReturnValue());

searchKeyChange: function(component, event) {
var searchKey = event.getParam("searchKey");
var action = component.get("e.c.findAll");
  "searchKey": searchKey
action.setCallback(this, function(a) {
    component.set("v.accounts", a.getReturnValue());


<aura:component >
    <input type="text" class="form-control"
           placeholder="Search" onkeyup="{!c.searchKeyChange}"/>


searchKeyChange : function(component, event, helper) {
    var myEvent = $A.get("e.c:SearchKeyChange");


<aura:event type="APPLICATION">
    <aura:attribute name="searchKey" type="String"/>

I can't for the life of me figure out what the issue is. Any feedback would be great.


Assuming that findAll is the remote method in your controller, I believe that your line in ContactListController.js:

var action = component.get("e.c.findAll");

should be:

var action = component.get("c.findAll");

This is causing the action to be null and the reference to setParams to throw an error.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.