FAQ: How can I automatically delete my own records that have been completed?
## Answer
This can be achieved with a "「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」" 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">
<article class="s-blog_list_unit"><h2>
<h2>The specified information was not found.</h2>
<p><a href="/ja/manual">Return to top</a></p>
</article>
</div><input id="SearchTextHidden" type="hidden" value="" />