You need to sign in to do that
Don't have an account?
Soujanya Uppal 9
update account record on basis of the conditions
i am getting this error Missing ';' at '{' please help
list<Account> accList= [select id,name,billingcity,annualrevenue,industry,rating from Account];
list<account> accNew= new list<account>();
for(account ac:accList){
if(ac.Billingcity=='Hyderabad')
{
ac.Rating='Hot';
}
elseif(ac.Billingcity=='Paris')
{
ac.Rating='Cold';
}
elseif(ac.Billingcity=='Austin')
{
ac.Rating='Warm';
}
elseif(ac.Billingcity=='Vizag')
{
ac.Rating='Yahoo';
}
else(ac.Billingcity=='Other')
{
ac.Rating='Google';
}
accNew.add(ac);
}
update accNew;
list<Account> accList= [select id,name,billingcity,annualrevenue,industry,rating from Account];
list<account> accNew= new list<account>();
for(account ac:accList){
if(ac.Billingcity=='Hyderabad')
{
ac.Rating='Hot';
}
elseif(ac.Billingcity=='Paris')
{
ac.Rating='Cold';
}
elseif(ac.Billingcity=='Austin')
{
ac.Rating='Warm';
}
elseif(ac.Billingcity=='Vizag')
{
ac.Rating='Yahoo';
}
else(ac.Billingcity=='Other')
{
ac.Rating='Google';
}
accNew.add(ac);
}
update accNew;
Hi,
please use the below code.It is working fine.
elseif is corrected to else ifPlease mark it as the Best Answer if your query is solved.
thank You