Development questions

When an Account Phone is updated, put the old phone number and new phone number into the Account Description field.

DevelopmentEasyInfosysMphasisHexaware

Use before update so the Description is saved without an extra DML.

apex
trigger AccountTrigger on Account (before update) {
    for (Account a : Trigger.new) {
        Account old = Trigger.oldMap.get(a.Id);
        if (a.Phone != old.Phone) {
            a.Description = 'Old Phone: ' + old.Phone + ', New Phone: ' + a.Phone;
        }
    }
}
apex-triggertriggercodingscenario