I want to create a new record in another table when I press the update button
Answer¶
Use "Script".
Overview¶
If you want to create a new record in another table after updating a record, you can implement this in a "Script".
Operation Procedure¶
- Create a time-limited table or recorded table
- Create a new "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.
- Create a new record using the [+New] button.
- Open the edit screen for the record created in 3 and press the [Update] button.
Execution Result¶
When you update a record in recorded table A, a new record is created in recorded table B.
Before update¶
Update record in recorded table A¶
After update¶
Code Samples¶
JavaScript¶
//Processing after pressing the "Update" button
$p.events.after_send_Update = function () {
getParentData();
}
function getParentData() {
//Create a record whose title column is "Title Test".
$p.apiCreate({
'id': 9999,
'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);
}
});
}


