You need to sign in to do that
Don't have an account?

Comparison arguments must be compatible types: String, Integer
Hi,
I'm trying to create a trigger to update 2 picklist fields based on the value of a number field. However, I get the following error on line 5:
"Comparison arguments must be compatible types: String, Integer"
Here's my code:
________________________________________________________
trigger UpdateHHIncome on Account (before insert, before update) {
Account acct = trigger.new[0];
{
if(acct.Household_Income__c == 1){
acct.Tax_Filing_Status_Peakfolio__c = 'Single';
acct.Household_Income__c = 'Up to $8,925';}
else if(acct.Household_Income__c == 2){
acct.Tax_Filing_Status_Peakfolio__c = 'Single';
acct.Household_Income__c = '$8,926 - $36,250';}
else{acct.Tax_Filing_Status_Peakfolio__c = 'Single';
acct.Household_Income__c = '$36,251 - $87,850';}
}
}
I'm trying to create a trigger to update 2 picklist fields based on the value of a number field. However, I get the following error on line 5:
"Comparison arguments must be compatible types: String, Integer"
Here's my code:
________________________________________________________
trigger UpdateHHIncome on Account (before insert, before update) {
Account acct = trigger.new[0];
{
if(acct.Household_Income__c == 1){
acct.Tax_Filing_Status_Peakfolio__c = 'Single';
acct.Household_Income__c = 'Up to $8,925';}
else if(acct.Household_Income__c == 2){
acct.Tax_Filing_Status_Peakfolio__c = 'Single';
acct.Household_Income__c = '$8,926 - $36,250';}
else{acct.Tax_Filing_Status_Peakfolio__c = 'Single';
acct.Household_Income__c = '$36,251 - $87,850';}
}
}
Also you can compare expression like acct.Household_Income__c = 'Up to $8,925' instead you can write acct.Household_Income__c>=8925. Dont use special characters while comparing integers with String
Ash
If this helps,please mark it as best answer to help others :)