Skip to main content
Question

How To Delete Record From Report Embedded On External Website

  • January 20, 2018
  • 0 replies
  • 128 views

I have a delete button on my report, which works fine when I'm in QuickBase, but it will not work when the report is embedded on another website. My goal is to have the capability to delete a record from an external site, so if there's other suggestions how to do this, that's ultimately what I'm trying to achieve. 
Here's the code I'm using on the button:

////////// ATTEMPT #1: CODE I FOUND FROM FORUM
"javascript:if(confirm ('Are you sure you want to delete this record?')){location.assign( '/db/" & Dbid() & "?act=API_DeleteRecord&apptoken=xxxxxxxxx&rid=" & [Record ID#]& "&rdr=" & URLEncode("https://www.website.com") & "')}"
//////////
I have attempted hardcoding the root domain since it assumes you're in QB, but had not luck.

/////////// ATTEMPT #2: ANOTHER CODE I FOUND ON THE FORUMS
var text URL= URLRoot() & "db/" & Dbid() & "?act=API_DeleteRecord&rid=" & [Record ID#]
& "&apptoken= xxxxxxxxx";
"javascript: " &
"if ( confirm('Are you sure you want to permanently delete this record ? ') == true ){ "&
"$.get('" & 
$URL & 
"',function(){" &
"location.reload(true);" &
"});" 
& "void(0);"&
"}"
//////////

The 2nd attempt works the same, but does not have a redirect on it back to the page I'd like it to go back to.

1. Is there a way for a externally embedded report to delete a record and redirect back to the external page? If not,
2. Is there a better way of deleting records from an external Wordpress site? I looked into the API integrations, but haven't found any clear examples.
This topic has been closed for replies.

I can't help you on the javascript syntax, but I do know that everything in Quick Base has to operate under the permissions of a userid.

You can use a usertoken to provide that Authentication.
https://help.quickbase.com/api-guide/create_user_tokens.html

you need to add the string

&usertoken=xxxxxxxxxxxxx

 and provide a valid user token.

Quincy,

Mark's method should be able to easily delete the record. However you need be aware of the fact that exposing usertoken on an external website is a security risk.

If you external website is public, I would suggest you basically add a new record in some table known as delete requests capturing the record ID of the original record.

Setup a webhook from that table to perform an API_DeleteRecord at the desired table.