You need to sign in to do that
Don't have an account?
'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;
}
}
}
}
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;
}
}
}
}
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.