function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dev87Dev87 

Lightning component: error when saving cmp file

Hello everyone, 
I created lightning component. I created cmp file and controller.js file.
I want to call controller in my cmp file but i have this error "Failed to save ObjectifsYear.cmp: Invalid definition for null:ObjectifsYear: null: Source"
Ca u help me.
 
Manish  ChoudhariManish Choudhari
Hi Dev,

Can you please provide code for your component file and controller file so that I can help on this.

Thanks,
Manish
Dev87Dev87
thank u, problem resolved, but I have another error while testing my component. " Cannot Read Property "setParams" of undefined.
I need to create an opportunity from a form. below the codes
.cmp


Controller.js
Apex Class


 
Manish  ChoudhariManish Choudhari
Hi Dev, 
On which line you are getting this error. I will suggest you to use debugger statement to find out resultToast or Action1 value before using setParams method on these.  There may be a chance that either one of this is null or undefined. Also please make sure:
1. In your component first line you are using controller="Objectifsyear"   to make sure your action1 is not null, Try to check if there is any spelling mistake along with case sensitivity. 
2. Also add this line before if-else statement in your controller
 
if(!resultToast) // this will make sure that following lines will only execute when the event is supported and not null
{
/*
Your if-else statement will go here
*/
}

Please let me know if this helps.

Thanks,
Manish