Morning all! I'm wondering if there is any way to intercept a delete action with a client script? essentially I want to emulate the "you cannot delete a record while child records" in a dialog for records that are not "system recognised" as being child records
s
Shubi
08/23/2021, 12:41 PM
Use a before submit script and ("context.type == "delete"){
//your code here
}
p
Paul_s
08/23/2021, 12:42 PM
This is in relation to a client script.
s
Shubi
08/23/2021, 12:43 PM
still waking up lol - my bad... not sure but check if anything executes before the record is deleted on saverecord. That could be it
p
Paul_s
08/23/2021, 12:44 PM
yeah, cant see anything referencing the delete event type on saverecord, hoping someone has a trick up their sleeve
c
CD
08/23/2021, 12:47 PM
The better way of doing this is to remove the delete button when child records exist
p
Paul_s
08/23/2021, 12:49 PM
That is certainly an option, wasn't aware you could remove from that actions menu there. Ideal scenario is a custom delete function that recursively removes the children