You need to sign in to do that
Don't have an account?

After update effect on triggers.
I have 2 triggers on Lead. At first it was like one before update, second with after update triggers. Later We have changed both the triggers to AFTER UPDATE. Now someof the functionalities are not working. Is AFTER update on both the triggers affecting?? If, YES please give your suggestios to resolve this.
As per my knowledge, both the triggers would be triggered whenever an update happens.But we can't control the order of trigger execution out of these two.
You can better the best practise in salesforce by having two delegate methods and calling two methods in the trigger.
For example :
Trigger afterupdateTriger on contact(after update)
{
TriggerDelegate.logic1(Trigger.new);
TriggerDelegate.logic2(Trigger.new);
}
class TriggerDelegate
{
public static void logic1(List<Id> contactIds)
{
}
public static void logic2(List<Id> contactIds)
{
}
}
I hope this approach will help you resolve.
Let me know if you need further help.
Thanks and Regards,
Shiva RV
//Handler
Public Class YourObjectHandler{
public static void LogicAfterUpdate(list<Projects__c> newRecords,Map<Id,Projects__c> OldRecordsMap)
//Your Logic
}
public static void LogicBeforeUpdate(list<Projects__c> newRecords,Map<Id,Projects__c> OldRecordsMap)
//Your Logic
}
//Trigger
trigger ProjectTrigger on Projects__c (before update,after update) {
if(trigger.isUpdate && trigger.IsAfter ){
LogicAfterUpdate(//Send old and new map that you need);
//LogicAfterUpdate(Trigger.new,Trigger.oldMap);
}
else if(trigger.isUpdate && trigger.IsBefore){
LogicBeforeUpdate(//Send old and new map that you need);
//LogicBeforeUpdate(Trigger.new,Trigger.oldMap);
}
}
Please mark it as solved if this solves your problem