Forum Discussion

GregoryHargrave's avatar
GregoryHargrave
Qrew Member
5 years ago

Formula Button that will Delete Current Record, Redirect to the db Dashboard and Display a javascript alert

Greetings, I am trying to create a formula button that will Delete the current record, redirect to the home page, and then display a java alert. I am aware of how to make the button to do the first two actions but cannot seem to integrate the javascript action with the other formula URL actions.  

Any help would be greatly appreciated.

var text urlone = 
URLRoot() & "db/" & [*Current Table*] & "?a=API_DeleteRecord&rid=" & [Record ID#] &
"&apptoken=*XXXXXXXX*"
;

var text urltwo =
URLRoot() & "db/" & Dbid()
;

var text urlthree=
"javascript:alert('The requisition will be deleted, please start again in order to make changes.');"
;

$URLONE
& "&rdr=" & URLEncode($URLTWO)
& $URLTHREE



------------------------------
Greg
------------------------------
  • Hi Gregory,

    While Javascript can be used in a code page, we do not recommend Javascript be inserted anywhere else in a Quick Base app. It is not a supported technique and it can stop working at any time without warning.

    For this particular workflow, I encourage you to link to a text page instead, which displays the message and then presents a link to your app's dashboard.

    Thanks,
    Brian
    Quick Base Product Marketing

    ------------------------------
    Brian Cafferelli
    ------------------------------
  • AustinK's avatar
    AustinK
    Qrew Commander
    You are missing the last slice of that formula.

    Try replacing the end of your formula and also change your variables to be the correct names to match the variables here in the formula below. That should fix it. If not, there is an additional issue in your URLs. 

    $URLONE  
    & "&rdr=" & URLEncode($URLTwo) 
    & URLEncode("&rdr=" & URLEncode($URLThree))

    My third edit, oh boy:

    This might not actually work with the javascript popup... I didn't notice that. Give it a go and report back.
  • Yeah, that Javascript is still giving me issues. After doing some research I am still not sure if it can be integrated with the other commands.

    ------------------------------
    Gregory Hargrave
    ------------------------------