URL BUtton using JS to delete record and child records

  • 0
  • 2
  • Question
  • Updated 7 months ago
  • In Progress
I am looking to create a URL Formula Button to put on a table homepage. I want to the button to be able to invoke a warning / confirmation to delete the record (and all its dependents) and when confirmed, the record and its child records should be deleted and then returns the user to the table hompage.

I have an idea how to do this but only for a single record and not it's dependents. 

I appreciate any help!
Photo of Niraj Shah

Niraj Shah

  • 214 Points 100 badge 2x thumb

Posted 7 months ago

  • 0
  • 2
Photo of Gaurav Sharma

Gaurav Sharma

  • 5,756 Points 5k badge 2x thumb
Hi Niraj,

How have many related child tables associated with your parent table?

Thanks,
Gaurav
Photo of Niraj Shah

Niraj Shah

  • 214 Points 100 badge 2x thumb
Hi Gaurav, thanks for the response.

I only have one child table directly related to the parent table. 

As a reference, here is what I am trying to achieve:

Create a button in the employees table that allows for the user to delete that employee. This
button should confirm with the user using a JS popup and then delete all child records (address
change log) and delete the record and return to the table home page.

Thanks,

Niraj
(Edited)
Photo of Alex Wilkinson

Alex Wilkinson

  • 1,006 Points 1k badge 2x thumb
Suggested strategy:
  1. On the parent record and on the child records, create a checkbox field "Delete This Record"
  2. On the parent record, create a Quick Base action to make "Delete This Record" on related child records to be the same as "Delete This Record" on the parent record, when that field on the parent is modified.
  3. Use the method outlined in this QB tutorial, which explains how to use a service like Zapier (or your own API calls) to accomplish tasks like bulk archiving or deletion:  https://university.quickbase.com/series/advanced-training/record-archiving-and-snapshotting-2503
If desired, you could also modify the report on your table homepage to either not display records where the box is checked or sort them to the bottom. And, perhaps before automating step 3, you could do it manually with reports that filter for records where the box is checked.
(Edited)
Photo of Niraj Shah

Niraj Shah

  • 214 Points 100 badge 2x thumb
Thanks, Alex. I don't think this will work for what I am trying to do. Here is the challenge I am trying to find a solution for:

Create a button in the employees table that allows for the user to delete that employee. This
button should confirm with the user using a JS popup and then delete all child records (address
change log) and delete the record and return to the table home page.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,256 Points 50k badge 2x thumb
I suggest signing up for early access to Automations.


That will allow you to trigger an Autonation when the Parent Record is deleted, to trigger the step to delete the children if that deleted Parent.

Put in a Support ticket to request early access.
(Edited)
Photo of Niraj Shah

Niraj Shah

  • 214 Points 100 badge 2x thumb
I've put a ticket in for this but am awaiting a response. In the meantime, I need to show a proof of concept for the following challenge:

Create a button in the employees table that allows for the user to delete that employee. This
button should confirm with the user using a JS popup and then delete all child records (address
change log) and delete the record and return to the table home page.

Let me know if you have an efficient way of achieving this.

Thanks!