Customer 360 for Salesforce
- Customer 360 for Salesforce Summer 2023
- All Products
trigger Custom_Account_Trigger on Account (after delete, after insert, after update, before delete, before insert, before update) { DSE.API_AccountTriggerHandler apiHandler = new DSE.API_AccountTriggerHandler (); DSE.API_DataQualityTriggerHandler daasAccountHandler = new DSE.API_DataQualityTriggerHandler('Account'); private Boolean enableAccountTrigger = true; private Boolean enableDAASTrigger = true; if(System.UserInfo.getUserType() == 'Guest') return; try { apiHandler.initTrigger(); } catch (Exception e){ enableAccountTrigger = false; } try { daasAccountHandler.initTrigger(); } catch (Exception e){ enableDAASTrigger = false; } try { if (Trigger.isInsert ) { if (Trigger.isBefore) { if(enableAccountTrigger) apiHandler.Trigger_InsertBefore_Handler(); if(enableDAASTrigger) daasAccountHandler.Trigger_InsertBefore_Handler(); } else { if(enableAccountTrigger) apiHandler.Trigger_InsertAfter_Handler(); if(enableDAASTrigger) daasAccountHandler.Trigger_InsertAfter_Handler(); } return; } if (Trigger.isUpdate) { if (Trigger.isBefore) { if(enableAccountTrigger) apiHandler.Trigger_UpdateBefore_Handler(); if(enableDAASTrigger) daasAccountHandler.Trigger_UpdateBefore_Handler(); } else { if(enableAccountTrigger) apiHandler.Trigger_UpdateAfter_Handler(); if(enableDAASTrigger) daasAccountHandler.Trigger_UpdateAfter_Handler(); } return; } if (Trigger.isDelete) { if (Trigger.isBefore) { if(enableAccountTrigger) apiHandler.Trigger_DeleteBefore_Handler(); if(enableDAASTrigger) daasAccountHandler.Trigger_DeleteBefore_Handler(); } else { if(enableAccountTrigger) apiHandler.Trigger_DeleteAfter_Handler(); if(enableDAASTrigger) daasAccountHandler.Trigger_DeleteAfter_Handler(); } return; } } catch (DSE.API_AccountTriggerHandler.DS_CloudMDMPartialTriggerFailureException e) { if (Trigger.isAfter) DSE.API_AccountTriggerHandler.AccountTriggerState = DSE.API_AccountTriggerHandler.TRIGGER_FAILURE_STATUS.TRIGGER_ROLLBACK_INPROGRESS; else DSE.API_AccountTriggerHandler.AccountTriggerState = DSE.API_AccountTriggerHandler.TRIGGER_FAILURE_STATUS.TRIGGER_FAILED; return; } }