I have a little problem. I have a simple program that gets a value from picklist , and using this value my program must show all values from the database

Thats my code


<aura:attribute name="trueevents" type="List"/>
<aura:attribute name="picksel" type="String" />

<lightning:select aura:id="PicklistId" name="Sensors Pick List" label="Select a Sensor" required="true"
                  value="{!v.picksel}" onchange="{!c.getTrueEvents}">
        <aura:iteration items="{!v.sensors}" var="item">  
            <option value="{!item.Name}" text="{!item.Name}" />  

<aura:iteration items="{!v.trueevents}" var="item">
                <tr class="slds-hint-parent">
                    <td data-label="Events Data">
                        <div class="slds-truncate" title="Sensor Name">
                    <td data-label="Events Data">
                        <div class="slds-truncate" title="Event_x">
                    <td data-label="Events Data">
                        <div class="slds-truncate" title="Event_y">
                    <td data-label="Events Data">
                        <div class="slds-truncate" title="Event_z">
                    <td data-label="Events Data">
                        <div class="slds-truncate" title="Sensor Max Vectors Difference">


getTrueEvents : function(component, event, helper) {
    var pickselected = component.find("PicklistId").get("v.value");
    console.log('pickselected--->>> ' + pickselected);
    var action = component.get("c.getTrueEvents");
    action.setParams({ searchName : pickselected});
    var self = this;                  
    action.setCallback(this, function(actionResult) {
        component.set('v.trueevents', actionResult.getReturnValue());



global static List<Sensor_Event__c> getTrueEvents(String searchName){

    List<Sensor_Event__c> events = new List<Sensor_Event__c>(
        [SELECT x__c, y__c, z__c, Sensor__r.Max_Vectors_Difference__c, Sensor__r.Name
         FROM Sensor_Event__c
         WHERE Sensor__r.name = :searchName] );
    return events;

Why have i gotten this mistake?

enter image description here


You cannot name your function in client side and apex class to be the same. "getTrueEvents"

Check this https://salesforce.stackexchange.com/a/275701/93221

  • Thank u! It helps! – Gr9988 Feb 19 at 22:37

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.