You need to sign in to do that
Don't have an account?
Kathleen Elisabeth Smith
Merging Accounts Sets off Trigger
I have a trigger on the Opportunity object that runs after an opportunity is deleted, inserted, undeleted, or updated, or before one is deleted, inserted, or updated. We use this to start a process on the Status of an Opportunity/Contract.
Has anyone had a similar issue to this when merging accounts, and what do you recommend I change in the Trigger so that it doesn't begin running when I merge accounts with opps?
Below is the code for trigger. Please let me know if you have any other questions. Thank you.
Opportunity_ContractTrigger
- If opportunity is "In Progress", then the account type is "Prospect"
- 2 Weeks later, if this is still "In Progress", the account type is reverted to the previous account type (either "Lead' or "Inactive Client")
- If opportunity is "Won", then the account type is "Active Client"
- If opportunity is "Lost", then account type is either "Lead" or "Inactive Client"
Has anyone had a similar issue to this when merging accounts, and what do you recommend I change in the Trigger so that it doesn't begin running when I merge accounts with opps?
Below is the code for trigger. Please let me know if you have any other questions. Thank you.
Opportunity_ContractTrigger
trigger Opportunity_ContractTrigger on Opportunity__c (after delete, after insert, after undelete, after update, before delete, before insert, before update) { if(trigger.isInsert && trigger.isBefore) { Opportunity_ContractTriggerHandler.OnBeforeInsert(trigger.new); } else if(trigger.isInsert && trigger.isAfter) { Opportunity_ContractTriggerHandler.OnAfterInsert(trigger.newMap); } else if(trigger.isUpdate && trigger.isBefore) { Opportunity_ContractTriggerHandler.OnBeforeUpdate(trigger.oldMap, trigger.newMap); } else if(trigger.isUpdate && trigger.isAfter) { Opportunity_ContractTriggerHandler.OnAfterUpdate(trigger.oldMap, trigger.newMap); } else if(trigger.isDelete && trigger.isBefore) { Opportunity_ContractTriggerHandler.OnBeforeDelete(trigger.oldMap); } else if(trigger.isDelete && trigger.isAfter) { Opportunity_ContractTriggerHandler.OnAfterDelete(trigger.oldMap); } else if(trigger.isUnDelete) { Opportunity_ContractTriggerHandler.OnUndelete(trigger.new); } }
Now to figure out how to keep merged accounts from firing the trigger....