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
anil maligaanil maliga 

Error: Compile Error: Comparison arguments must be compatible types: String, Integer at line 3 column 4 please explain what is the problem in that?

trigger anyname on paytm__c (before insert,after update) {
for(paytm__c y:trigger.new){
if(y.phn_no__c<=10){
y.phn_no__c.adderror('hello enter vaild phone number');
}
}
}
Best Answer chosen by anil maliga
Raj VakatiRaj Vakati
Looks like the phone number is of type String so change the code as below 
 
trigger anyname on paytm__c (before insert,after update) {
for(paytm__c y:trigger.new){
if(y.phn_no__c.length()<=10){
y.phn_no__c.adderror('hello enter vaild phone number');
}
}
}



 

All Answers

Raj VakatiRaj Vakati
Looks like the phone number is of type String so change the code as below 
 
trigger anyname on paytm__c (before insert,after update) {
for(paytm__c y:trigger.new){
if(y.phn_no__c.length()<=10){
y.phn_no__c.adderror('hello enter vaild phone number');
}
}
}



 
This was selected as the best answer
Raj VakatiRaj Vakati
Looks like the phone number is of type String so change the code as below 
 
trigger anyname on paytm__c (before insert,after update) {
for(paytm__c y:trigger.new){
if(y.phn_no__c.length()<=10){
y.phn_no__c.adderror('hello enter vaild phone number');
}
}
}