The onDelete Function in JavaScript Code
You can configure the onDelete function to execute whenever a user tries to delete a record on a device. The onDelete function is typically used to restrict records from being deleted on a device. For example, to prevent users from deleting open activities on a device. You can also use onDelete to control the record deletion on a device by using a value in a parent record. For example, if there is a locked field set to Yes or No to indicate whether an account is locked or not, then you can perform a check to only allow contacts to be deleted if the parent account has a locked status of No. For more information about the structure of JavaScript code, see "JavaScript Structure Used in Swift MEAP."