I try to set up a trigger that modifies the email adress on the User object once I hit the button "Disable Customer Account" on Account. I have seen the discussions where you should use "IsPortalEnabled" instead of "IsActive" on the User object to determine if the user object got disabled. So, generally it should function (see Run a trigger when disabling a customer user)
However, in my case the trigger does not even get fired:
trigger User on User (before insert, before update, after insert, after update) {
SM018_UserTriggerHandler handler = new SM018_UserTriggerHandler();
if((Trigger.isUpdate) && (Trigger.isBefore)){
System.debug(logginglevel.debug, 'Update Before');
}
if((Trigger.isInsert) && (Trigger.isBefore)){
System.debug(logginglevel.debug, 'Insert Before');
}
if((Trigger.isUpdate) && (Trigger.isAfter)){
System.debug(logginglevel.debug, 'Update After');
}
if((Trigger.isInsert) && (Trigger.isAfter)){
System.debug(logginglevel.debug, 'Insert After');
}
}
I do not get any entry in the debug log - what am I missing here? If I modify the User directly and not via the button "Disable Customer Account", the trigger functions.
Should I set up a trigger on Account despite the discussions that the trigger should function on the User object? And is the correct field for the trigger "IsCustomerPortal" then?