Skip to main content
Question

Can I use a formula URL button to create an email using an email client and redirect to the initial report?

  • November 2, 2017
  • 0 replies
  • 198 views

I'm trying to make it easier for my CRM users to research a lead and email a lead so I'm providing URL buttons to enable a google search or a mailto: link.  I'm also trying to track the activity to provide a report to their managers so I need to 1) edit the record, 2) open the email and then 3) redirect back to the original report.  I'm struggling to get the third re-direct to work. 

Code is below

var text weblink = "http://www.website.com";

var number NewToggleValue = If ([Email toggle]=true,0,1);

var text URLONE = URLRoot() & "db/" & Dbid()
& "?act=API_EditRecord&key=" & [Record ID#]
& "&_fid_419=$NewToggleValue"&"&apptoken=aaaaaaaaaaaaaaaaaaaaaaaaaa";

var text URLTWO = "mailto:"&[email address]&";"&[Sales Rep for Leads - Email Address (P)]&";"&[Sales Rep for Leads - Email Address (S)]&"?subject=Your inquiry about ..." &"&body=Hello,%0A%0AThank you for your interest in ...  I?m ... ? the sales representative in your area.  My contact details are below.   If there is anything I can do to help with your project, please don?t hestitate to contact me.   %0A%0AThank you.  %0A?"&"{insert name here}"&"%0A"&"{and email here}"&"%0A... You may personalize the message by modifying this text.%0A"&"%0APlease click the link below to learn more: %0A" &$weblink;

var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=q&qid=153";

"<a href="& $URLONE & "&rdr="& URLEncode($URLTWO) &URLEncode("&rdr="& URLEncode($URLTHREE))&"'><img   src=\"https://images.quickbase.com/si/32/016-email_0.png\"></a>";
This topic has been closed for replies.

Kevin,

Your URLTWO is not actually a URL but a hyperlink to open outlook/mail client. As such quickbase does not know what happens at URLTWO. Without having a finish line for URLTWO it cannot redirect to URLTHREE.

One alternative is to swap URLTWO & THREE.

That way it will edit record , reopen record and open outlook mail.

  • Author
  • Registered
  • January 21, 2018
Yep - that�s it. Thanks brother.

  • Registered
  • November 5, 2018
Hiya, got a similar issues, what does this bit of code mean "?a=q&qid=153"?  To me it's action = query and query ID = 153, but what is this query?  (If I'm reading the code right).

It means to run report number 153

  • Registered
  • November 5, 2018
Try using the IOL Technique with this button formula and module.js:

Paste Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=686

Notes:

(1) I did not test this. Any scenario using an <iframe> and/or the mailto protocol needs to be tested as there may be different behaviors between browsers and the user's registered handler for the mailto protocol.

(2) To prevent the mailto protocl opening an empty tab/window it is opened instead in a hidden <iframe>. Very clever if you ask me.

(3) The three asynchronous tasks (1) ?act=API_AddRecord, (2) ?a=dr and (3) mailto: are arranged in the most likely sequence to have them complete one after the other. But the process is not perfect as the mailto process cannot be monitored.

  • Registered
  • November 5, 2018
Thanks, I'll give that a go, my last try of trying to get this to work was by adding 

"javascript:" &
"location.reload(true);" &
"$.get('" & 
$URLONE
&"&rdr=" & URLEncode($URLTWO) &
URLEncode("&rdr=" & URLEncode($URLTHREE)) &
&"
"');" &
"void(0);"

This ran URLONE and URLTWO but no email popped up for ULRTHREE.

: / 

  • Registered
  • November 5, 2018
Wow!!!! worked first time!!!! Dan, you're a star.  Do you mind us using this code? Can't thank you enough, been stuck on this for a couple of days. 

  • Registered
  • November 5, 2018
Knock yourself out. Just remember to put my ironclad copyright notice in the bottom of the code or I will have my team hunt you down.
All rights reserved. The code in this page is copyright by Dan Diebolt and may not be used without including my phone number (773-312-8131) and email address (dandiebolt@yahoo.com) in the footer of where you may want to use it.


  • Registered
  • November 5, 2018
Thank you and will do : )