Tuesday, January 27, 2015

Get the updated field Name in trigger

Trigger updateAccount on Account(after update){
 for(Account act:trigger.new){
  Account oldAccountId=Trigger.oldMap.get(act.Id);
  Map<String, Schema.SObjectField> M = Schema.SObjectType.Account.fields.getMap();
  for (String str : M.keyset()) {
   if(act.str != oldAccountId.str){
    system.debug('******The value has changed!!!! ');
    // here goes more code
   }
  }
 }
}

No comments:

Post a Comment