FAQ: I want to create a new record in another table when I press the update button
## Answer
Use "[Script](/en/manual/table-management-script)".
---
## Overview
If you want to create a new record in another table after updating a record, you can implement this in a "[Script](/en/manual/table-management-script)".
## Operation Procedure
1. Create a time-bound table or record table
1. Create a new "[Script](/en/manual/table-management-script)", enter the following script content, and set the site ID to any value (in the example below, the site ID is set to 1083). Check "「Edit」" for the output destination and update it.
1. Create a new record using the [+New] button.
1. Open the edit screen for the record created in 3 and press the [Update] button.
### Execution Results
#### Before Update
![image](https://pleasanter.org/binaries/40e86defc11646fdab0a0621fcaa4d3c)
#### Record Update
![image](https://pleasanter.org/binaries/fd03d5f08a504bc49c814cf41863b150)
#### After Update
![image](https://pleasanter.org/binaries/a6665641382b4f9ca667183e13396312)
## Sample Code
##### JavaScript
```
//Processing after pressing the "Update" button
$p.events.after_send_Update = function () {
getParentData();
}
function getParentData() {
//Create a record whose title item is "Title Test".
$p.apiCreate({
'id': 1083,
'data': {
'Offset': 0,
'Title': 'FAQ: Sample code: Create another record after pressing the update button'
},
'done': function (data) {
$p.clearMessage();
$p.setMessage(
'#Message', JSON.stringify({
'Css': 'alert-success',
'Text': 'A new record has been created'
}));
},
'fail': function (data) {
console.log(data);
}
});
}
```
## 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="" />