Play Games

Search This Blog

Wednesday, May 24, 2017

Error: Compile Error: unexpected syntax: 'extraneous input 'City' expecting SEMICOLON'

Solution:This type of errors occur when we provide spaces in between api names of fields.
trigger ContactAddresUpdate on Contact (before insert,before update) {
    if(trigger.isBefore && (trigger.isInsert || trigger.isUpdate)){
        for(Contact objC : trigger.new){
            if(objC.MailingCity != '') {
                objC.ksk__Languages__c = objC.Mailing City;
            }
        }
    }
}
For example in above code,in this line objC.ksk__Languages__c = objC.Mailing City;
Mailing city is one field and its api name is MailingCity.
So we need to modify that line to objC.ksk__Languages__c = objC.MailingCity; to resolve the issue.

No comments:

Post a Comment