Auto delete records based on amount of records and age
Hi there,
in our Creator dashboard we have hundreds of apps, each app has a form and a report. Most reports now have several hundred records each - managing and clearing these out when we start to run out of space is becoming a monstrous job therefore I'm looking to create a couple of clever little delete functions to help me out.
For a bit of background, we use creator in order to take and send messages to clients, the form uses a sendmail function to email the client, the report is used as a history view. The form below is a generic example of how we do things via sendmail. At the top is a signature which is being used like a global function
by calling the "callsignature" string from the "dynamic_signature" app.
- signature=dynamic_signature.callsignature();
- sendmail
- [
- from:zoho.adminuserid
- to:"###@####.co.uk"
- subject:"MESSAGE"
- message:"<br>You have a new message for ####: " + formdata + "<br><div></div><div><br></div><div><br></div><br>" + signature + "<br><br><br>_<br>"
- content type:HTML
- ]
I want to create the delete scripts in a similar way that the signature has been done. The signature is declared as a global variable from a "Dynamic Siganture" application where there is various different signatures listed - the one in use being callsignature
So I want to create 2 delete scripts in this same fashion so that I can place and use them per application as required.
Script 1: would be to keep only the last 100 records entered
Script 2: would delete records over 6 months old.
The reason being is that those with a "call" signature only require around 100 records to be kept, everything else we need a 6 month record history.
I have been trying to research this but there is nothing within the last few years that is of any help I would appreciate if someone could tell me or show me how to create these two scripts