I am very new in Lightning App Development. I am getting an error this error(Uncaught error in $A.run() : component is not defined) When i want to pass the component value to the Apex(Server-Side Controller) in lightning using JS(Client-Side Controller).

Here is my Code for my Code

COMPONENT enter image description here

CLIENT SIDE enter image description here

SERVER SIDE CONTROLLERenter image description here

  • 1
    did u check if there are ticket, event product & event records existing for the ticket id you are passing ? Aug 13, 2015 at 7:02
  • yes there is .. Aug 13, 2015 at 7:04
  • 1
    It will be best if you can paste your code here instead of images, so that we can try on our machine. Aug 13, 2015 at 8:40
  • ya.. sorry.. next time i will paste my code . i already solve the error. Thankyou for your will to help. i really appreciate it. Aug 13, 2015 at 9:12

1 Answer 1


One problem is that in your button, the press attribute shouldn't be written as a merge field.

<ui:button label="Go" press="c.search" />

You also have a misspelling in your client-side controller. It should be:

search : function(component, event, helper){ 

You might be getting the message "component is not defined" because the variable was named "componet"

Also, you could also simplify you server-side controller if you wanted: (unrelated to the error)

public class CheckinCntrlr{
    public static String checkfoundevent(String ticketid1){
        Ticket__c obj = [
            SELECT Event_Product__r.Event__c.Name 
            FROM Ticket__c
            WHERE Id = :ticketid1
        return obj.Event_Product__r.Event__c.Name;
  • Thankyou for your will to help. I already solve the problem :) Aug 13, 2015 at 9:10
  • @DanrylTigolCarpio Excellent. Glad I could help.
    – martin
    Aug 13, 2015 at 9:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .