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
Dhanamjaya PaidipatDhanamjaya Paidipat 

Error: Variable does not exist

Hi All,

I have developed below Apex trigger one month back but it was working as expected, but suddenly since two days it showing below error:
Kinldy help me why it's occured this issue suddenly.
Compile Error: Variable does not exist: MobilePhone at line 4 column 7

Apex Code:
trigger QualifiedMobileNumber on Lead (Before Insert) {
for (Lead a:Trigger.new){
for (Lead a1:[select id,MobilePhone, Status__c from Lead where Status__c='Qualified']){
if(a1.MobilePhone==a.MobilePhone && a1.Status__c=='Qualified'){
a.adderror('Your number is Qualified');
}
}
}        
}
Raj VakatiRaj Vakati
Try this code
trigger QualifiedMobileNumber on Lead (Before Insert) {
for (Lead a:Trigger.new){
for (Lead a1:[select id,MobilePhone, Status__c from Lead where Status__c='Qualified']){
if((a1.MobilePhone==a.MobilePhone)&&( a1.Status__c=='Qualified')){
a.adderror('Your number is Qualified');
}
}
}

 
Raj VakatiRaj Vakati
trigger QualifiedMobileNumber on Lead (Before Insert) {
for (Lead a:Trigger.new){
for (Lead a1:[select id,MobilePhone, Status__c from Lead where Status__c='Qualified']){
if((a1.MobilePhone==a.MobilePhone) && ( a1.Status__c=='Qualified')){
a.adderror('Your number is Qualified');
}
}
}

 
Dhanamjaya PaidipatDhanamjaya Paidipat
Hi Ravi,
Same issue again.
Raj VakatiRaj Vakati
It worked for me  .. this is the code 
 
trigger QualifiedMobileNumber on Lead (Before Insert) {
    for (Lead a:Trigger.new){
        for (Lead a1:[select id,MobilePhone, Status__c from Lead where Status__c='Qualified']){
            if((a1.MobilePhone==a.MobilePhone)&&( a1.Status__c=='Qualified')){
                a.adderror('Your number is Qualified');
            }
        }
    }
}