+ Start a Discussion
bhanu_prakashbhanu_prakash 

'extraneous input 'City' expecting SEMICOLON'

Hi have created trigger to copy billing city into Suburb, it is throwing error 'extraneous input 'City' expecting SEMICOLON'

trigger ContactAddresUpdate on Contact (before insert,before update) {
  if(trigger.isBefore && (trigger.isInsert || trigger.isUpdate)){  
      list<string> lstStr = new list<string>();
      for(Contact objC : trigger.new){
                if(objC.MailingCity != ''){
                   lstStr = objC.Mailing City;
                  objC.Suburb__c = lstStr;
                  }
}
}
}

 
sunny522sunny522
Hi Bhanu,
     You have given space in between Mailing and city  in this line  lstStr = objC.Mailing City;.Thats why its giving that error.Try like this
trigger ContactAddresUpdate on Contact (before insert,before update) {
  if(trigger.isBefore && (trigger.isInsert || trigger.isUpdate)){  
      for(Contact objC : trigger.new){
                if(objC.MailingCity != ''){
                  objC.Suburb__c =objC.MailingCity;
                  }
}
}
}

Let me know if u need more help.
bhanu_prakashbhanu_prakash
Thanks sunny small errors hit us lot. LOL :)
sunny522sunny522
Please mark it as solution if it helps