logo

NJP

How to Use Table Cleanup | ServiceNow Tutorial

Import · Apr 04, 2024 · video

[Music] hello everyone good day today we are going to discuss about table cleaner so what is table cleaner and what are the limitations in the table cleaner and what are the new Fields introduced in the vancour release on the table cleaner before we are stepping into the table cleanup setup let me have few discussions about what is table cleaner so whenever we we are using table cleaner it will delet the older records automatically and prevents the data from growing and we have few limitations in the table cleaner it is not supported for tables that are configured to use table rotations or table extensions performance will be depends on the size of the table and what are the conditions you are providing in the table so table cleaner will spins maximum of 20 minutes to delete the the records from a single table this may increase based on the conditions let me go to the table Cleanup in navigation you can search as table cleanup open the table cleanup which is under instance scan click on all Let me show the existing record which I have already created again we can create a new record first let me show the existing one I created it on incident table so which is having activ is true so here I'm mentioning that I need to delete 100 day 100 days ago data in this particular incident table and which are inactive records let me go to the incident table so here you can see all the data is deleted based on the condition and I have only single record why this single record is not deleted is active is false but created is 2 months ago not 100 days so it's just 60 days ago so it it's not deleted this record and all other records are deleted so let me create a new one for us so I already opened a new record for new record here so table name so here we need to mention Target table name where we are going to delete the data I'm going with the case table match field this match field is auto automatically populated when we are creating a new autof flesh record it will be a cisor created uncore on if you want to change this field you need to you can or you need uh you can change it but it should be updated or created based on Dat or Time Field always match field should include with dat or Time Field AG in seconds if you are going with zero or aging seconds it will clean all the data in that particular table if if you giving any specific age in seconds like I'm giving it as 100 days 100 days in seconds this is the 100 days in seconds so you need to specify in seconds only so active by activating this it will run so Cascade delete option so it will uh help us to delete the related records or reference records if you can check it so it will delete the difference records or related records based on this particular table records which are going to delete so if you are unchecking it it won't delete related records or reference records it will delete only that particular record in the case table so these are the two new Fields introduced in the vancor release one is clean peripheral here you can see this peripheral field is us it to delete the records from the attachment tables or Journal field tables if you have any uh Records in that particular tables like attachment tables or Journal Fields it will delete if you're unchecking it it won't delete the records in that particular tables clean audit this is also like if you have any records in the audit table related to the record which you are going to delete it will delete all those records if you're checking it if you're unchecking it won't delete so this is how it works let me give AC is false I'm going to delete the inactive records which is 100 days ago let me save this record or submit This Record meanwhile let's go on to the case table and this is the case table and I have filtered with inactive records we have total six records and in these six records also it will take based on the 100 days filter so we have only one record let's see it should delete that one record it's saved so this table will be run every 1 hour yeah we have a schedule job or scheduler written on this particular table so it will run every 1 hour and it will check for the conditions and age in seconds it will delete the records in this particular table let's check that job schedule job so I'm going into the schedulers let's check how much time it is scheduled from now table cleaner so it is going to run after 1 minute so this particular conditions or autof flesh which we have here it will run 1 minute from now let's wait for 1 minute and check the result let me reload this page this is how you need to configure the table cleanups so uh by writing the scripts we can delete the records based on the condition but we need to uh but we need to write other scripts to delete related records or reference records or audit records so this is the best way to use the table cleanup so uh we can say it as no code or low code platform by using table cleanup so let me check it less than a minute from now let's wait for a minute and we are giving it as inactive records and 100 days older records let's check it see it is already triggered the schedule and here you can see it is updated for next one hour so from now it will execute again from next one hour let me go to this case list and we have total of six records and all the records are inactive records and we have only one record which matches that created date Let me refresh this page so here you can see we have earlier six records now it is five records and all are inactive but not 100 days these all are 7 days ago and 9 days ago this is how we can use the table cleanup and it is a easy way to use without scripting thank you he

View original source

https://www.youtube.com/watch?v=QXmG1yg6k1A