FAQ: How can I automatically delete my own records that have been completed?
## Answer
This can be achieved with a "[Script](/en/manual/table-management-script)".
---
## Overview
This is a sample that deletes your own record if the status item is "Complete" after pressing the update button.
## Operation Procedure
1. Create a time-limited table or record table.
1. Create a new "[Script](/en/manual/table-management-script)" and enter the contents of the script below. Check "Edit" for the output destination and update.
1. Create a new record using the [Create New] button.
1. Open the edit screen for the record created in 3, set the [Status Item] to "Complete", and press the [Update] button.
## Sample Code
##### JavaScript
```
//Processing after pressing the "Update" button
$p.events.after_set_Update = function () {
$p.ex.DeleteMySelfData();
}
$p.ex.DeleteMySelfData = function() {
//Executes self-deletion when the status is "Complete".
if ($p.getControl('Status').val() == 900) {
$p.apiDelete({
'id': $p.id(),
'done': function () {
$p.clearMessage();
$p.setMessage('#Message', JSON.stringify({
Css: 'alert-success',
Text: 'The status is now [Completed] so the record has been deleted'
}));
},
'fail': function () {
console.log('Failed to delete record');
}
});
}
}
```
## Related Information
<div id="ManualList"><ul><li><a href="/en/manual/table-management-script">Table Management: Script</a><span>08.13.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />