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
rajgopal10rajgopal10 

How to copy address from Account object to Contact object

I have a scenario, after clikc on Copy from Parent Account check box,

address copied from Account object  to Contact object.

without using any customization how i can reach this...

can it possible to using Workflow rules ?
salesforce mesalesforce me
Hi check this once
trigger UpdateAddress on Account (after update) {
    Set<Id> accountIds = new Set<Id>();
    for (Account a : Trigger.new) {
        Account old = Trigger.oldMap.get(a.Id);
        if (a.BillingStreet != old.BillingStreet || ...) {
            accountIds.add(a.Id);
        }
    }
    if (accountIds.size() > 0) {
        Contact[] updates = [
                select Id, AccountId
                from Contact
                where AccountId in :accountIds
                ];
        for (Contact c : updates) {
            Account a = Trigger.newMap.get(c.AccountId);
            c.BillingStreet = a.BillingStreet;
            ...
        }
        update updates;
    }
}