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
pranavshahpranavshah 

Error: Compile Error: Variable does not exist: First_Name at line 5 column 3

Hi All,
While writing  triggers, i am getting below error

Error: Compile Error: Variable does not exist: First_Name at line 5 column 3    
Code:

trigger HelloWorld on Lead (before Update)
 {
for(lead l: Trigger.New)
{
l.FirstName ='Hello';
l.LastName  ='World';
}
}
Best Answer chosen by pranavshah
Aman MalikAman Malik
This error make sense.
Can you verify you don't have an apex class with the name 'l' in your org. If you have, delete it and try to save code again.

Thanks

All Answers

Aman MalikAman Malik
Hi,
Above code is working for me. are you sure, you posted a right code?

Thanks,
Aman
pranavshahpranavshah
ys..aman ..is their any profile level or object level setting
Aman MalikAman Malik
Hi,
Error is looking strange. Even you are not using 'First_Name ' keyword in the code, its giveing you above mentioned error.
Can you cross check if you posted a right error.

Thanks
pranavshahpranavshah

Error: Compile Error: Variable does not exist: FirstName at line 5 column 3
Aman MalikAman Malik
This error make sense.
Can you verify you don't have an apex class with the name 'l' in your org. If you have, delete it and try to save code again.

Thanks
This was selected as the best answer
pranavshahpranavshah
yes... thanks it got solved...their was class name starts with 'l' for lead
Aman MalikAman Malik
Hi Pranav,

Please like the answer and mark it as best if this resolve your issue.

Thanks,
Aman
pranavshahpranavshah
Aman, 
one more help, if you have scenario based question on trigger & validation rule, will you pleasee share with me on pranav17shah@gmail.com

Thnks in advance