You need to sign in to do that
Don't have an account?
jenny_j_chen1.3971006870153901E12
How to catch user info change like email change or a user is frozen in a user trigger (after update)?
We are catching history of users in a custom object, called UserHistory. I used Trigger on User and i can catch most info changes except user email change and if user is frozen (by the freeze button).
The issue with email : Salesforce is not changing user email, it sent an email to the new and old email address. However, inside the user trigger, oldValue and newValue of email are the same, so it did not catch the change.
The issue with frozen user : i don't see any field or flag on user, what can i do?
Thank you for your help.
The issue with email : Salesforce is not changing user email, it sent an email to the new and old email address. However, inside the user trigger, oldValue and newValue of email are the same, so it did not catch the change.
The issue with frozen user : i don't see any field or flag on user, what can i do?
Thank you for your help.
As a very basic example you can pull the IsFrozen value when the trigger is fired and do something with it, however I do not know of a way to get the trigger to fire every time it is changed due to it being in another object.
trigger TestUserLoginFrozen on User (after update) {
for (User u : Trigger.new){
UserLogin ul = new UserLogin();
ul = [SELECT UserId, IsFrozen
FROM UserLogin
WHERE UserId = :u.Id];
System.debug(ul.IsFrozen);
}
}