Well today while working with triggers I observed a weird issue.
In my org I have a object called Demo__c
and which has a standard "Name" field and another field called "TimeStamp__c". I have a following trigger on this object .
trigger DemoTrigger on Demo__c (before update,after update) {
for(Demo__c demo : trigger.new){
if(demo.name!=trigger.oldMap.get(demo.Id).name){
System.debug('New-->'+demo.name+'<-------'+trigger.oldMap.get(demo.Id).name);
}
else{
System.debug('#######SAME##############');
}
}
}
And a worflow that updates the "TimeStamp__c" field everytime the record is updated.
So when am updating the "Name" field what I was expecting is to see this line "New-->'+demo.name+'<-------'+trigger.oldMap.get(demo.Id).name"
in the debug and when the workflow is firing I was expecting #######SAME##############
since this will invoke the trigger again but somehow things are adding up after field am seeing "New-->'+demo.name+'<-------'+trigger.oldMap.get(demo.Id).name"
again in the debug. Am really confused just wanted to know if it is the expected behaviour?