✏️ Explanatory Question
The delete() method is a standard method of a form data source. This method is called when a record is deleted.
Example
You have a custom form with a table named TrainingMaster. The table has a field named TrainerID, which has a foreign key relation with the TrainerTable. TrainerTable has a field named TrainingCount. The requirement is to reduce the TrainingCount number by one if a record is deleted from the TrainingMaster table.
The coding pattern can be as follows:
public void delete()
{
TrainerTable trainerTable;
ttsbegin;
trainerTable = TrainerTable::find(TrainingMaster.TrainerID, true);
trainerTable.TrainingCount = trainerTable.TrainingCount - 1;
trainerTable.update();
ttscommit;
super();
}