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

Reassign records based on criteria
Hey All
hope is well, i need some advice / pointers
I understand that with the new 14 release we can create triggers on the user object (not sure if this is the case)
Aim - In this example https://www.youtube.com/watch?v=QrtVN8vZGJU you can see that “Jim Smith” is going through the de-activation process . What i want to do, is when you press save, an apex trigger is triggered and automatically re-assigns “Jim Smith” Leads into this appropriate manager
Looking around, It shouldn't be an issue to grab the users's id, and the manager id and change ownership of those leads to the new user, but i may be mistaken and i need some help.
The Main issues that potentally could stop this from working is
1. If there isn't a manager listed you could not assign.
2. If the manager is also inactive you will not be able to assign the leads (you can only assign records to active users).
3. If any of the leads have not been edited by the current user and there is validation on the lead that hasn't been completed then the lead will not get reassigned.
Below are answers to your 3 questions:
1) in this case you can assign that lead to a pre identified admin user or a queue.
2) same as 1....assign to a queue
3) here you have to code around your validation rule. or add an exception in your validation rule
I agree with all Rahul's 3 answers, but I want to add a tip for #3 to add an exception in all the lead validation rules with AND Owner:User.IsActive = true. So the trigger can reassign the leads from the inactive user without errors from the lead validation rules.