Delete a record without going into grid edit or going into the selected record

  • 0
  • 2
  • Question
  • Updated 8 months ago
  • Answered
Hi, is it possible to delete a record from the table view with quickbases native features?
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb

Posted 2 years ago

  • 0
  • 2
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,240 Points 50k badge 2x thumb
No problem,
You can make a URL formula button to delete a record and refresh the page. But there is no "are you sure" step on this so be careful.

var text URL= URLRoot() & "db/" & Dbid() & "?act=API_DeleteRecord&rid=" & [Record ID#]
& "&apptoken= xxxxxxx";


"javascript:" &
"$.get('" & 
$URL & 
"',function(){" &
"location.reload(true);" &
"});" 
& "void(0);"


if you have application tokens enabled on the app properties tab for the application, then you will need to supply that long code number.  or else just disable them as not being needed.
Photo of Matthew Neil

Matthew Neil

  • 31,478 Points 20k badge 2x thumb
If you want to take is a step further... what happens to all the child records of the parent you delete?  
They become lost in space, and really reek havoc on your reporting.
.
.
In comes "Clean Delete" to save the day.  We have a tool that will delete, in one click, the parent, the children, and grandchildren records.


QuickBase is about data, but if your data becomes 'dirty' over time, its hard to trust the reports.
Photo of Niraj Shah

Niraj Shah

  • 214 Points 100 badge 2x thumb
How do we utilize this functionality?
Photo of Jordan

Jordan

  • 1,574 Points 1k badge 2x thumb
This did the trick, thank you!
Photo of Ammar

Ammar

  • 312 Points 250 badge 2x thumb
Tying to  QuickBaseCoach App Dev./Training, Champion answer, You can do something like this for confirmation:

var text URL= URLRoot() & "db/" & Dbid() & "?act=API_DeleteRecord&rid=" & [Record ID#]
& "&apptoken= xxxxxxx";

"javascript: " &
"if ( confirm('Are you sure you want to permanently delete this record ? ') == true ){ "&
"$.get('" & 
$URL & 
"',function(){" &
"location.reload(true);" &
"});" 
& "void(0);"&
"}"
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,240 Points 50k badge 2x thumb
Thx for that post!  Good addition to the Community base of knowledge.
Photo of Printmark

Printmark

  • 406 Points 250 badge 2x thumb
Trying to figure out how to use this to delete a child record in a embedded report.  It is a line item on an order form, and I want to have the option to delete the line item.  The record ID# does not appear on the embedded report used to enter line items.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,240 Points 50k badge 2x thumb
Just use my post which begins with "no problem ...."
Photo of Printmark

Printmark

  • 406 Points 250 badge 2x thumb
Yeah, I've tried it.. It refreshes the screen, but the record is still there.
 
This is what I have as a Formula-URL Button in an embedded report.

var text URL= URLRoot() & "db/" & Dbid() & "?act=API_DeleteRecord&rid=" & [Record ID#]
& "&apptoken= d7xnw2xdw9v4qnrm2ptkcyndgx3";


"javascript:" &
"$.get('" & 
$URL & 
"',function(){" &
"location.reload(true);" &
"});" 
& "void(0);"
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 53,240 Points 50k badge 2x thumb
The code is failing and refreshing the screen.

To debug it when using that JavaScript method, you would just run the URL itself without the JavaScript stuff

Ie, comment out the JavaScript and just instead do $URL

What you will find is an error saying invalid application token.

You will then recheck it until you go cross eyed or until you notice it has an embedded leading space after the = which is causing the code to fail.
Photo of Printmark

Printmark

  • 406 Points 250 badge 2x thumb
Wow.. thanks, I never noticed the leading space on the app token.  Thank you, it works like a charm now.

This conversation is no longer open for comments or replies.