It is a complex issue so I'll try to descrive each steap as clearly as possible.

At first I hace this CMP that I 'll call "rootCMP".


This component is called from an event because it works as a right side bar and need to render it with parameters that comes from other components on the page. For this case parameter1 value comes with this event.


<aura:component controller="OController">
  <aura:attribute name="parameter1" type="String" />

  <div class="ASH2 slds-border_bottom" > TITLEt </div>
    <div class="H1" /> 
      <!-- Page Content -->
    <div class="slds-text-heading_small slds-p-bottom_small">

    <c:CMP_ListigItems parameter1="{!v.parameter1}"/>
    <!-- Page Content -->
    <div class="slds-text-heading_small slds-p-bottom_medium">
    <c:CMP_Parent1 parameter1="{!v.parameter1}"/>

This RootCMP calls to CMP_ListingItems who receives parameter1 from RootCMP

  <aura:attribute name="label" type="String" />
  <aura:attribute name="itemsList" type="Items__c[]" />
  <aura:attribute name="parameter1" type="String" default=""/>

  <c:AS_GetItemsByParametery parameter1="{!v.parameter1}" items="{!v.itemsList}"/>

  <div class="slds-pill_container">
    <aura:iteration var="item" items="{!v.itemsList}">
      <c:AS_ITemPill item="{!item}" parameter1="{!v.parameter1}" />

The component AS_GetItemsByParameter is used to retrieve a list of items filtered by parameter1.


<aura:component implements="force:appHostable,force:lightningQuickAction" controller="Controller" access="global">
parameter1 | {!v.strategyId}
  <aura:attribute name="parameter1" type="String" />
  <aura:attribute name="items" type="Item__c[]" />

  <aura:handler name="init" value="{!this}" action="{!c.onInit}" />

As you can see in this CMP i'm printing the value of parameter1 and it is being showed in the screen. The issue starts in the controller.

AS_GetItemsByParameterController.js in the third line of the onInit method, you can see an alert to view the value of parameted1 but the value that it throws is undefined

  onInit: function(component, event, helper) {
    var action = component.get("c.getITemsByParameter");
    var parameter1 = component.get("v.parameter1");
      parameter1: parameter1

    action.setCallback(this, function(response) {
      var state = response.getState();
      if (state === "SUCCESS") {
        var items = response.getReturnValue();
        component.set("v.items", items);
      } else {
        console.log("Failed with state: " + state);



  • The apex code who is called by the controller is working well for other methods.
  • The architecture of usng a component to retrieve things and other to list them is working in other components too.
  • 1
    can you please update u r question with how did you get v.parameter1 value in RootCMP? – sdandamud1 Nov 25 '19 at 13:03
  • @sdandamud1 done! thanks for your time on reading my question. – Martin Larizzate Nov 25 '19 at 13:11
  • 1
    can add aura if for testing to check parameter1 is exiting while loading childcmp ` <aura:if isTrue="{!not(empty(v.parameter1))}"> <c:CMP_ListigItems parameter1="{!v.parameter1}"/> </aura:if> ` – sdandamud1 Nov 25 '19 at 13:17
  • @sdandamud1 I just tested your Idea, but the issue persists. – Martin Larizzate Nov 25 '19 at 13:38

The issue was the event who builds RootCMP

I was building it using just an aura:if and solved it loading dynamically de RootComponent.

In the solution I replaced the aura:if with an attribute of type Component.

and it is being loaded with a function like this:

loadRootCMP: function(component) {
            "parameter1"  : component.get("v.parameter1"),
        function(newCmp, status, errorMessage) {
            if (component.isValid()) {
                if(status == "ERROR") {
                    console.log('Creating Dynnamic component- Error Message--',errorMessage);
                component.set("v.RootCMPContainer", newCmp);
        } );

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.