KirkTrachy1
5 years agoQuickbase Staff
"Soft Delete" | Protecting your data from accidental deletion
A customer asked me today to help him recover records that were accidentally deleted. Well, hopefully you know that in an emergency, you can open a support case and our care team can help but he wanted to PREVENT the event from happening in the first place. My immediate thought was that this was another use case that would benefit from having a restore feature but there is a better and simpler solution using what one of our Senior Product Manager, Harrison Hersch calls "Soft Delete".
Say you have a community of users that are notoriously deleting records and you need to restore them. For simplicity we'll call them Sales people, but we have all done this.
How about we craft the Sales role to not allow record deletions? This solves part of the problem, but the other part is that the Sales people really would like to delete some records. Well, how about adding a checkbox we can call, "Soft Delete" and we adjust the Sales Role so they can only view records where the "Soft Delete" checkbox is unchecked. This now means that the Sales people can check the checkbox and the records will disappear from view. Whatever record they check will appear to be deleted but in fact it has only disappeared from their Sales role's view. We can then create a report that only contains records with the checkbox check and Administrators can now review, restore or permanently delete.
A whole bunch of things can be added to this process to make it slick and easy to manage.
Steps:
The code for the Formula URL button can look something like this:
Update the apptoken specific for your application and change the fid_26 to reflect the field ID number of your checkbox field.
NOTE: QuickBase does not support the use of JavaScript in buttons. An alternative button below may be used instead but you will have to manually decide where you want to redirect. In the example below this will leave you on a report (qid=1).
We cover topics like this each weekday in our "Office Hours" webinars. This is an open conversation inviting questions and live modeling of how-to solutions. M-F at 1pm Eastern time. Register at: http://quickbase.com/webinars/
------------------------------
Kirk Trachy
QuickBase | Senior Solutions Engineer | 603-674-5454 M | ktrachy@quickbase.com
------------------------------
Say you have a community of users that are notoriously deleting records and you need to restore them. For simplicity we'll call them Sales people, but we have all done this.
How about we craft the Sales role to not allow record deletions? This solves part of the problem, but the other part is that the Sales people really would like to delete some records. Well, how about adding a checkbox we can call, "Soft Delete" and we adjust the Sales Role so they can only view records where the "Soft Delete" checkbox is unchecked. This now means that the Sales people can check the checkbox and the records will disappear from view. Whatever record they check will appear to be deleted but in fact it has only disappeared from their Sales role's view. We can then create a report that only contains records with the checkbox check and Administrators can now review, restore or permanently delete.
A whole bunch of things can be added to this process to make it slick and easy to manage.
- We can add a button that checks that checkbox
- We can create a subscription report to remind the Administrator to review, restore or delete the records permanently
- We can create a schedule automation to delete the flagged records
- We can add a table to the app to handle Sales people's escalation requests to restore accidentally deleted records.
- The list can go on...
Steps:
- Add the "Soft Delete" checkbox to your form or report.
- Create a Sales role (or whatever community of users you want protection)
- Flag the role so Deletions are disallowed
- Customize the View so you can only see records where the "Soft Delete" is not checked
- Optionally add a Formula URL button that will make checking the checkbox easier. You can press the button whether you are in display mode or edit mode. If you don't have a button, you will have to put the record in edit mode to check the checkbox.
The code for the Formula URL button can look something like this:
var text url = If([Soft Delete] = false, URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=biwvb32baypdx8cqfjj9pk2xiim&rid=" & [Record ID#] & "&_fid_26=1", URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=biwvb32baypdx8cqfjj9pk2xiim&rid=" & [Record ID#] & "&_fid_26=0"); "javascript:" & "$.get('" & $url & "',function(){" & "location.reload();" & "});" & "void(0);"
Update the apptoken specific for your application and change the fid_26 to reflect the field ID number of your checkbox field.
NOTE: QuickBase does not support the use of JavaScript in buttons. An alternative button below may be used instead but you will have to manually decide where you want to redirect. In the example below this will leave you on a report (qid=1).
If([Checkbox] = false, URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID #] & "&_fid_101=1" & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=q&qid=1"), URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=c7y3n83dz8fuc2n8jum5dzq4iky&rid=" & [Record ID #] & "&_fid_101=0" & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=q&qid=1"))
We cover topics like this each weekday in our "Office Hours" webinars. This is an open conversation inviting questions and live modeling of how-to solutions. M-F at 1pm Eastern time. Register at: http://quickbase.com/webinars/
------------------------------
Kirk Trachy
QuickBase | Senior Solutions Engineer | 603-674-5454 M | ktrachy@quickbase.com
------------------------------