Custom rule for deleting a record, possible?

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
When you go into a table's access panel to view the roles and their permissions against it, you have the option to make custom rules for the viewing and modifying of a record.  There is no option like this available for the deleting of a record. Just a checkbox to enable/disable deletion.  

Is there anyway from within QuickBase that I can create a custom rule to allow deletions of a record except for specific rule base settings?

My specific example is this.

I have several records, along with table relationship fields listed in it.  I want to block a record from being deleted (user cannot click the delete button, or it isn't completed) when a specific field is "checked", such as a "record locked" field.


Here is a screen shot (view/modify have it, but the delete only has the checkbox)


Maybe this is a new feature request?  Hoping there is a way for me to do this without that request/wait time.

Thank you!
Photo of Ryan

Ryan

  • 170 Points 100 badge 2x thumb

Posted 5 months ago

  • 0
  • 1
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,256 Points 2k badge 2x thumb
The way I handle deletions is to build a custom method for users to "mark" a record for deletion.  This triggers a change to the record which can hide it from the Users; but not from administrators.  Administrators are then notified by email (notification or subscription) of records to delete.  They make the final decision to delete or not.  Once data is deleted it is gone.  Mistakes are easily made.  This method for me ensures that data is not "accidentally" deleted, which results in a lengthy process with Quick Base to retrieve lost data.  Also, often data is "connected"; so that means the deletion process is likely more than just a single-table of records.

Another methodology I deploy is to create a delete-only Administrator Role.  This means that even Admins cannot delete records unless they switch to a role using the "test as a role" feature.  This prevents even Admins from accidentally deleting records they do not mean to (and trust me, this happens more often than it should).  If they have to switch roles, it means they know they are deleting records from a given table.

You can then have other triggers delete child-connected records; or build a button to do all the deletions itself.  Make this button visible only to the Roles that should be allowed to delete.

This helps protect your data; and protects you from additional administrative work/liaison in the event of a mistake.  It's much easier to "uncheck" a box or empty a date value than to retrieve lost records.
Photo of Gaurav Sharma

Gaurav Sharma

  • 5,756 Points 5k badge 2x thumb
Hi, there is no native solution to solve this problem. but, you can easily hide the delete button with the help of some code.

Create a formula-Rich text field and paste the following code.

If([Your checkbox field]=true,

"<img src=\"/i/clear2x2.gif\" " &
"onload=\"javascript:if(typeof QBU=='undefined'){QBU={};$('#deleteButton').hide();}\">", "")
Just try this and let me know if this solution works for you.

Thanks,
Gaurav
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 50,850 Points 50k badge 2x thumb
Here is another approach.  Make an Automation to delete the record when a certain checkbox is checked.  The automation run under the Permissions authority of who created it (actually who last modified it).

So sort of by remote control, the user can request the automation to fire.

Then you have infinite control over who can see or edit that checkbox field and even if the user does not have permissions to delete record, that can "phone a friend" (if you remember that TV show "Who wants to be a millionaire"), and ask them for help.
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,256 Points 2k badge 2x thumb
Mark - this is a nice approach too.  Since Automations is new; it is interesting to see all the different ways in which this feature can be used to replace older clunky work arounds /mechanisms.  Personally, I still have concerns over accidental deletion of records, even by Administrators - which I have sadly seen too often.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 50,850 Points 50k badge 2x thumb
The other approach that i used to use was a webhook to delete the single record.  But there is some 'coding" syntax involved in setting up a webhook, so I would not try to guide someone though that coding on this forum.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,242 Points 20k badge 2x thumb
I can't for the life of me understand why there is this aversion to coding.

Even psychonaut Terence McKenna realized everything is code:

Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,256 Points 2k badge 2x thumb
After building a few automations myself; I am sure many users will take that route instead of Webhooks, where appropriate.
Photo of Ryan

Ryan

  • 170 Points 100 badge 2x thumb
Thanks for all the replies. I've been busy with a couple other projects and now able to get back into this one. Will take a look at the automation, and also the button hiding shortly.
Photo of Ryan

Ryan

  • 170 Points 100 badge 2x thumb
So what worked for me is to remove the delete permission for all access on the table in question. Then leave just the administration role with the delete permission. (I would have created another role, but then it looks like I would have to setup a user specifically for that role when I created the automation then).  This allowed the delete method to disappear completely for that table, both with the form and with any grid edits or users like to do. I then create a checkbox for deleting and added it to the form. Then I created the automation script to be triggered when a record in that table is modified and the deletion checkbox is checked.  This worked.  I also added in another step to that to modify the parent table (for our case) and add a note stating who deleted the record and basic information about that record.  Works great!

Glad they added the automations!

Thanks!