Skip to main content
I am fairly new to writing triggers, so I took a shot at this one because I thought it would be pretty simple. I have looked a tons of example and can't seem to figure out what I am doing wrong. I would like to update base address information from a field called Metro Area when address is null. However I keep getting the error "Expression cannot be a statement at line 4 column 14".

Code is listed below:

trigger UpdateMailingAddressMetro on Contact (Before Insert, Before Update) {

    for(contact c: trigger.new){

        If(c.Metro_Area__c.contains('Houston') && (c.mailingcity == NULL) && (c.mailingstate == NULL) && (c.mailingpostalcode == NULL)){

            (c.mailingcity == 'Houston');

            (c.mailingstate == 'TX');

            (c.mailingpostalcode == '77001');

            (c.mailingcountry == 'United States');

                }else {

                    c.mailingstate == NULL;

                    }

        }

}
2 answers
0/9000