Excluding tables from system clone

adrianblakey
Tera Contributor

Hi - we've been asked to exclude all our HR module data (hr cases, tasks, attachments etc) from our sytem clones

I understand from the documentation that you cannot exclude a table inherited from the task table.

https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/administer/managing-data/task/t...

THe queston is whether anyone has found a way to only partially exclude data from the task table (i.e. where task type is HR task or HR case)?

I've just spent the whole day running a background script to delete the data after the clone, and I think this will become more of a time issue hte more data is intered ito our system.

Also, I added a simple exclude on the sys_attchments table which doesn't seem to have worked either..

Has anybody encountered or overcome anything like this?

1 ACCEPTED SOLUTION

Use the GlideTableCleaner API. It is optimized for speed and performance. For example, here's a piece of code that would delete any incident record created more than 1 second ago. The API also automatically detects and deletes related attachment records.


new GlideTableCleaner('incident', 1, 'sys_created_on').clean();



NOTE: Since this API is not documented it is not officially supported. Beware.


View solution in original post

10 REPLIES 10

HI I tried this today and it deleted all the HR cases very quickly, but did not process any of the attachments, tasks, metrics etc. Some process then started re-creating a whole bunch of new blank cases - I suspect this might be a business rule or something like that. I logged out to kill the process, and because I'm pressed for time will have to clone again and delete the cases   using deleteMultiple() because I don't have confidence in the data integrity of this delete.



I'll try to look into this again when I can   - seems very promising and certainly runs very fast!



Thanks again


Adrian


Teena Singh
ServiceNow Employee
ServiceNow Employee

Adrian,


Glad to see that you are using the Community to learn more.


The Customer Experience team is striving to ensure that customer queries posted from the HI Service Portal are answered in timely and accurate fashion.


If you feel your question has been resolved, please mark the appropriate reply in the thread as being the Correct Answer.


This enables other customers to learn from your thread.


Thank you in advance.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Regards,


Teena Singh
Customer Experience: UX Strategy and Customer Insights
teena.singh@servicenow.com


ServiceNow


Screen Shot 2017-01-19 at 8.55.52 AM.png


shloke04
Kilo Patron

Hi Adrian,



Please refer the below link in section 7.3 on how to excludes tables from cloning:



System Clone - ServiceNow Wiki



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi - thanks for getting back to me - this option is very useful, but unfortunately   does not work for tables that are extended from the "task" table - i.e. I can exclude all tasks but not selectively just HR cases and HR tasks. I'm going to try a script using the table cleaner as suggested by Matthew Watkins   - will probably have to re-do my clone tomorrow anyway, so will report back!!




See


https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/administer/managing-data/task/t...



"The system cannot exclude tables that extend the Task table and are also flattened                               into it as part of the table per                                       hierarchy extension model. Since these extended tables are actually part                               of the same physical database table, the system clones the data when it clones the                               Task table. You can exclude tables that extend the Task table under two conditions.                               Either the system stores the tables in their own physical tables as part of the                               table per class extension model, or you exclude the Task table itself."



Regards


Adrian


BhupeshG
Tera Guru

Hi - Are you able to find a way to exclude hr_case table from Clone