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
chaithaly gowdachaithaly gowda 

Does 'After update' trigger fire even if the fileds dont get updated?

Hi

I have a trigger on event for after update , and inside the trigger i have given the condition if(trigger.isupdate){//statements}.

The scenario is, I am creating an event record , the after update trigger is executing the statements inside isupdate block in the same transaction.

Kindly help if i am missiong something.

Thanks
 
Best Answer chosen by chaithaly gowda
chaithaly gowdachaithaly gowda
Thanks for the reply.

The update trigger was executing on insert because in the same transaction a workflow was updating the record,and as per the order of execution after trigger fired on record update due to workflow field update.
Noticed this with the debug log.

Thanks

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Chaithaly,

To my knowledge yes, but in case if you don't want to update you could compare the new value to the old value and then if there is any change then you could perform the logic, also tri checking the condition for trigger.isafter as well.

I hope this helps.

Regards,
Anutej
 
Pravesh Uniyal 20Pravesh Uniyal 20
Hii Chaithaly Gowda!

Please can you clear the exact scenario again. BUT meanwhile try writing the code in the trigger as below it might work as you may be missing this: 

If ( Trigger.isUpdate && Trigger.isAfter ){
       //STATEMENTS
}


If it work then please assign it as the best answer.

Thanks and Regards!
chaithaly gowdachaithaly gowda
Thanks for the reply.

The update trigger was executing on insert because in the same transaction a workflow was updating the record,and as per the order of execution after trigger fired on record update due to workflow field update.
Noticed this with the debug log.

Thanks
This was selected as the best answer