Base de connaissance
Comment pouvons-nous vous aider ?
Recherche intégrale du site

How to automatically delete records that are over x days old?

Suppose you must automatically delete entries from your system after a certain period due to specific cybersecurity regulations. In that case, you can consider adding a script to your database to help you automatically delete records that are over x days old on a specified sheet. For example, if you want to delete records that are 28 or more days old automatically, please follow the steps below:

Step 1: Open the Ragic Workflow Editor

Right-click on any application tabs and select Global Javascript Workflow, which will take you to the workflow module panel.

Step 2: Switch to "Daily Workflow"

Step 3: Specify the Sheet Path For Your Workflow

If the URL of the respective sheet for your workflow is: https://www.ragic.com/accountname/tabname/1 Then, please fill in the following:
db.deleteOldRecords("/tabname/1",28);

Be sure to save your changes before exiting. If you want to change the number of days in the setting, modify the number after "db.deleteOldRecords('/tabname/1')". For example, if you want a record deleted if it is 20 or more days old, you should enter:

db.deleteOldRecords("/tabname/1",20);
Please note: 1. This workflow is only for deleted records from a single sheet. It does not delete records from the entire database. 2. To ensure the record is indeed deleted, the script will permanently remove the record. It will not be moved to the Recycle Bin, which means it cannot be recovered. Please make sure you absolutely need this feature before writing the related script.

Haut de page

    Essayer Ragic gratuitement

    Connectez-vous avec Google