function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdclearnsfdclearn 

Error in trigger

trigger AddressToAccount on Address__c (after update) {
/////////////////////////////////
// This Trigger updates the Case status of the related opportunity//
/////////////////////////////////

if(trigger.isafter && trigger.isafter) {
List<Address__c> lstAddress = [SELECT Account__c,Billing_City__C,Billing_State__c,Billing_Country__c FROM Address__c WHERE Account__c IN :trigger.new];
List<Account> lstAccounts= new List<Account>();

for(Address__c ad : trigger.new) {

{
for(Account ac: lstAccounts) {
{
ac.BillingCity=ad.Billing_city__C;
ac.BillingState=ad.Billing_state__c;
ac.BillingCountry=ad.Billing__Country__c;
lstAccounts.add(ac);
}
}

}

}

// Bulk DML
if(lstAccounts.size() > 0) { update lstAccounts; }

}
}

 

I am getting the following error for the above trigger.

Invalid bind expression type of SOBJECT:Address__c does not match domain of foreign key at line 7 column 139

 

Please advise.

Thanks!

 

AasifAasif

Is Account__c a vlookup or master/detail field to Account object?

In this SOQL query you are actually trying to compare account id with the custom object Address__c.

Thats why the error.

 

Also i think "trigger.isafter" is repeated.