Report Retirement for Inactive Users

adamtoth
Tera Contributor

Hello,

 

Is there a way to retire all reports that were created by inactive users?

 

Thank You!

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@adamtoth 

There is no direct way but you need to use 1 time fix script for this

If you don't require those reports then you can query sys_report table and check the created by user is inactive.

If yes then mark the report as active=false

@adamtoth 

There is no direct way but you need to use 1 time fix script for this

If you don't require those reports then you can query sys_report table and check the created by user is inactive.

If yes then mark the report as active=false

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@adamtoth 

Did my reply answer your question?

If my response helped please close the thread by marking my response as correct so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar , if the report is "Active = false",

1)Can this report be used in the dashboard?

2)If this report already published in Dashboard, it is will still visible?

3)Is this report able to search or link of this report able to use again?

 

Thank you.
 

Runjay Patel
Giga Sage

Hi @adamtoth ,

 

You can use below script either in fix script or scheduled job if you want to make it automation. You can run job once in a year.

var gr = new GlideRecord('sys_report');
    gr.addEncodedQuery('created_by_user.active=true');
    gr.query();
    while(gr.next()) {
      gr.active = false;
      gr.setWorkflow(false);
      gr.update();
    }

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------