Forum Discussion

QuickBaseCoachD's avatar
QuickBaseCoachD
Qrew Captain
6 years ago

edit a record and redirect to an outside website

Does anyone know the Syntax to to an update in Quick Base and then land the user on an outside website?

var text AddAcknowledgment = URLRoot() & "db/" & "xxxxxxxxx" & "?act=API_AddRecord"
& "&_fid_8=" & ToText([Record ID#]);

var text eScreen = "http://www.google.com";


$AddAcknowledgment
& "&rdr=" & URLEncode($eScreen)



The above would work if the redirect was to another Quick Base page, but does not work to redirect to an outside web page.  It tries to land me on a Quick Base page starting with my realm URL.

10 Replies

  • I don't believe using the standard rdr would work, but you could do embedded javascript using a $.get() to make your edit and then do a window.location.replace or window.open to have your new page open. So along these lines

    "javascript: {
    "$.get('" & $AddAcknowledgement & "');" & 
    "window.location.replace('" & $escreen &"');}"

    Something to that effect will like work

    Chayce Duncan | Technical Lead
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base
  • That worked and was immensely helpful.  I just added a missing closing " on the first line.  Posting the correction here for others to find.

    "javascript: {
    "$.get('" & $AddAcknowledgement & "');" & 
    "window.location.replace('" & $escreen &"');}"

    My next test will be to see if I can get this to work as a button in an email Notification.
  • No guarantees without further testing and potential quirks in different email clients, but another option if your intent is to try this through email is to embed an onclick function inside of an <a> tag. 

    Something like

    "<a href='#' onclick='(function(){$.get(\"" & addCall & "\");window.location.replace(\"" & $eScreen & "\");})()'>Click Here</a>"

    No guarantees on the syntax for Quick Base, but you could put that in a rich-text formula and the effects should be the same but more applicable outside of Quick Base

    Chayce Duncan | Technical Lead
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base
  • Here is my complete code.  The table where the records bare being added into is open to EOTI.


    var text AddAck = URLRoot() & "db/bpfq364aa" & "?act=API_AddRecord"
    & "&_fid_8=" & ToText([Record ID#]);
    var text eScreen = "https://escreengo.com/";
    "<a href='#' onclick='(function(){$.get(\"" & $AddAck & "\");window.location.replace(\"" & $eScreen & "\");})()'>Click Here</a>"

    We are probably on the right track as the code works perfectly within Quick Base.

    But when used in an email notification it redirects within Quick Base and fails.  Any other suggestions would be much appreciated. 
  • Since they'll be in their email client, you may want to try 

    var text AddAck = URLRoot() & "db/bpfq364aa" & "?act=API_AddRecord"
    & "&_fid_8=" & ToText([Record ID#]);
    var text eScreen = "https://escreengo.com/";
    "<a href='#' onclick='(function(){$.get(\"" & $AddAck & "\");window.open(\"" & $eScreen & "\");})()'>Click Here</a>"    

    The difference in window.location.replace changing to window.open for your var eScreen. Would mean ideally that it would open the link in a new tab for them
  • Alas the same result.  The link in the email notification stays in Quick Base and fails.  But works perfectly when used clicking a record in Quick Base.  But the whole goal here is to get non users to click an email link.

  • I dug around a little bit, email clients from what I can find don't support javascript, so the method I proposed won't work. Perhaps if someone else in the community has an idea around the rdr issue the led to this, they can jump in. Else - last ditch alternative might be to set up a really simple Quick Base HTML code page, and in that code page, let it run a quick addRecord call in that code, then do a redirect from that code page. 

    So you'd have a standard quick base code page - https://yourealm.quickbase.com/db/realm?a=dbpage&pageid=10 which you could embed in the email, user clicks that, stuff runs, then redirects from that page. 

    I wouldn't call it seamless or the prettiest solution- but it seems like if you need it to run solely through an email, you'll need to hit some kind of intermediary link first, be it Quick base or some alternative
  • That is actually a brilliant solution and I think will be good enough. We can make that landing page very pretty.

    Thank you very much for your help as we went back-and-forth on this. I know I have paid it forward so to speak with a lot of answers on this Forum here so it�s nice to get something back too.
  • ... this is crazy but I now think that the simple syntax which I originally posted will work in most cases.

    var text AddAcknowledgment = URLRoot() & "db/" & "xxxxxxxxx" & "?act=API_AddRecord"
    & "&_fid_8=" & ToText([Record ID#]);

    var text eScreen = "http://www.google.com";


    $AddAcknowledgment
    & "&rdr=" & URLEncode($eScreen)


    The real problem is that I learned that there are Realm level settings only accessible to Quick Base support which can block external redirects.