How can I perform the apex change of address?

327    Asked by Aalapprabhakaran in Salesforce , Asked on Apr 26, 2023

Can you write an apex class and trigger and explain?

Answered by Aashna Saito

Write a trigger on accounts. Take the list of account ids which are getting updated. Then get the list of all the contacts which are associated with that account. Run over the loop of accounts and contacts and see if (AccounId == ContactId). Inside the loop make Contact.Address = Account.address and add all contacts to a list. Update contact list outside the FOR loop.


Your Answer

Interviews

Parent Categories