Forum Discussion

NirajShah1's avatar
NirajShah1
Qrew Cadet
7 years ago

URL BUtton using JS to delete record and child records

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!

6 Replies

  • Hi Niraj,

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

    Thanks,
    Gaurav
    • NirajShah1's avatar
      NirajShah1
      Qrew Cadet
      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
  • AlexWilkinson's avatar
    AlexWilkinson
    Qrew Assistant Captain
    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.
    • NirajShah1's avatar
      NirajShah1
      Qrew Cadet
      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.
  • 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.
    • NirajShah1's avatar
      NirajShah1
      Qrew Cadet
      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!