+ Start a Discussion
pranav shah 40pranav shah 40 

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 pranav shah 40
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
pranav shah 40pranav shah 40
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
pranav shah 40pranav shah 40

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
pranav shah 40pranav shah 40
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
pranav shah 40pranav shah 40
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