Get the active manager if the user's manager is inactive

RamSagar
Tera Guru

Hi,

Actually i had requirement that if the user is made inactive if should automatically assign the records of the user to there respective manager, if the manager is inactive then it should search for the manager's manager (manager.manager) and so on.....

Please help in getting the logic for this.


Thanks in advance.

3 REPLIES 3

Abhinandan Pati
Giga Guru

Hi Ramu,



Write an update Business Rule on sys_user table which should trigger whenever active field changes to 'false'. Then query all the tables where sys id of the current user is same as that of value present in the 'assigned_to' field.



Now update 'assigned_to' field of all those records with the manager's sys_id of the inactive user, if & only if manager's account is active. You can dot walkin the current record to check for 'active' check box/ to get the sys_id of the manager.But here you need to take care of hierarchy.



Thanks,


Abhinandan.


Thanks patil for you're quick response, but how can i get the manager's manager record and there hierarchy.


if possible provide the code snippet for me.


Community Alums
Not applicable

You should be able to do this with a business rule.



Table: sys_user


When: after


Advanced: True


Conditions: Active -> Changes to -> false



Then write a script to query the user's manager, then the records assigned to them (on task table), and change assignment group/assigned to accordingly.