Forum Discussion

DavidBerndt's avatar
DavidBerndt
Qrew Cadet
7 years ago

Mailto and then close the window

I have a function URL button that first does a save of my record and then is triggering a mailto URL call.  I cannot have the system send the email as we want it from the user AND they have to add an attachment that is not within Quickbase.  

What happens though with a mailto is it ends on a blank screen.  I've tried to add a 3rd rdr (see below) but it never gets executed.  Any thoughts on how to either close the window (if I open in a new tab) OR to at least do a redirect on the original tab so I can just train them to close the blank window?

var text URLONE = URLRoot() & "db/" &Dbid()& "?a=API_EditRecord" & 
"&rid=" & [Call ID#]&
"&apptoken=dkd26r6bx8rtbvb7jgewkbbxeb7b"&
"&_fid_86=Complete";

var text URLTWO = "mailto:" & [Pharma Start Email] & "?subject=Visit for subject " & [Subject ID] & "&body=This is a test.  Please enter text from Darcy here%0A%0AThe original call notes are: " & URLEncode([Progress Notes]) & "%0A%0AAttach the POF file%0A%0AClick this link to enter the visit schedule details " & URLEncode([Link to Schedule Visit by nurse]) & "%0A%0AClick this link after the visit to enter the visit details " & URLEncode([Link to update call by nurse]);

$URLONE & "&rdr=" & URLEncode($URLTWO) & URLEncode(URLRoot() & "db/" & Dbid())

2 Replies

  • Ok - found it - thanks to ideas from Kirk Trachy(Magic Button) and Mark Shnier, Your QuickBase CoachQuickBaseCoach 

    Basically you can via the JavaScript open a new window with the mailto info and then close it.  Unfortunately it needs either a sleep function (seen here) or a monitor loop because if you run the close right away the mailto may not get executed.

    So this code:
    1) Updates the record to a "Completed" status
    2) Opens a window to generate a mailto call
    3) Waits for the window to be open
    4) Closes the blank window remaining from the mailtto
    5) Open/returns to the dashboard in the initial tab/window

    --------------------
    var text url=

    URLRoot()& "db/" &Dbid()& "?a=API_EditRecord" & 
    "&rid=" & [Call ID#]&
    "&apptoken=d9eascudwjxs2sesxkjccwgtq9r"&
    "&_fid_86=Completed";

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

    "javascript:" &
    "$.get('" & 
    $url & 
    "'," &

    "function() {" &
    " win = window.open('mailto:name@comp.com');" &
      "var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) {     if ((new Date().getTime() - start) > milliseconds){       break;    }  } }"
      " win.close();}" &
    ");" &
    "void(0);
  • Something you can use in conjunction with this is a email autologger - the way it works is that you append the QuickBase table name and record ID to the subject, have that forward to a gmail, and have that gmail account pulled into quickbase.  Then you can make a formula Parent ID field which pulls the ID out of the subject and relate it to the parent table