How to remove the delegates from the delegates table who are inactive/terminated??

girishk
Tera Expert

Hi,

There are users who are assigned as delegates to some directors,But those users are already terminated or inactive in the system.

How can we delete them from the delegates table??kindly help on the same.

thanks

2 REPLIES 2

raves12
Kilo Sage

Run a background script to Query into delegates table and check for the delegates to delete those whose are inactive.



Use gr.deleteMultiple() with caution for a faster result.


karthik120
Giga Expert

Hi Girish,



You can do something like this............



var g = new GlideRecord('sys_user_delegate');


var qr = g.addQuery('delegate.active','false');


qr.addOrQuery('delegate.locked_out','true');


g.query();


while(g.next()){


g.deleteMultiple();


}



As you are deleting the record please be cautious.



Thanks,


Kartik