+ Start a Discussion
Lee SinLee Sin 

How do I know what field has been updated in the trigger?

I woud like to get the field name of the updated field in the after update trigger.

So how can I get the name in the trigger?

Update or Insert the particular objects record, and check the debug log, you'll get to know which trigger executes after the DML operation you've done. and after that go to the trigger and you can check whatever the thing that trigger has done.

Abhi Tripathi
Salesforce Developer
Use Trigger.Old and Trigger.New to compare the values before and after update. Use if condition inside  the trigger 

string updatedfield;
if(trigger.old.get(Id).field__c != Trigger.new.get(id).field__c){
  updatedfield = "field__c";