User Data
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 06:00 AM - edited 05-14-2025 06:11 AM
Hi Team,
We have requirement that if user account is not active and "data erase" check box is true on user table we have to remove user personal details from ServiceNow like mobile number email id etc and we have to remove the user related info as well data in incidents, problem, change etc so i using schedule job and script include to achieve this can any one assist how delete sys_audit ,sys_email,sys_general_field data related to these records of the user can anyone help me in the script i am using below code calling from schedule job
userdata :function(){
var gr = new GlideRecord('sys_user');
gr.addQuery('data_erase',true);
gr.addQuery('active',false);
gr.query();
while(gr.next()){
gr.email="";
gr.phone='';
gr.mobile_phone='';
gr.u_gdpr_processed='true';
gr.update();
var inc=new GlideRecord('incident');
inc.addQuery('opened_by',gr.sys_id);
inc.query();
while (inc.next()){
inc.short_description='';
inc.description='';
inc.update();
}
var chg= new GlideRecord('change_request');
chg.addQuery('opened_by',gr.sys_id);
chg.query();
while(chg.next()){
chg.short_description='';
chg.update();
}
0 REPLIES 0