Discussions

Expand all | Collapse all

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

Kevin O'Boyle01-21-2018 02:01

QuickBaseCoach Dev./Training11-05-2018 12:23

Jack Fretwell11-05-2018 16:24

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

    Posted 11-02-2017 03:39
    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>";


  • 2.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 01-21-2018 01:58
    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.


  • 3.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 01-21-2018 02:01
    Yep - that�s it. Thanks brother.


  • 4.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 10:45
    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).


  • 5.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 12:23
    It means to run report number 153


  • 6.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 12:25
    I have put an App in the Exchange called URL formula for Dummies. It is a starter guide to making URL formula buttons.


  • 7.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 12:38
    Hiya, I had a look at this last week and didn't really find anything that matches this issue, I'm also using the magic buttons app which has helped a bit.
    The issue I'm seeing is when the command for the email is run it plonks the mailto command in the URL which then shows a blank page.  I can't seem to the mailto command without impacting the URL, which is a tad annoying.


  • 8.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 12:48
    Can you post your current code.?

    I think it might work if you put the mail to command is the last step in the URL formula and also send that checkbox to open a new window


  • 9.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 12:58
    This is what I have at the moment.

    var text URLONE = URLRoot() & "db/" & [_DBID_ACTIVITIES] 
    & "?a=API_AddRecord&_fid_148=" & URLEncode ([Record ID#])
    & "&_fid_157=" & [Related Company] 
    & "&_fid_7=Email Sent";

    var text URLTWO = URLRoot() & "db/" & [_DBID_CONTACTS] & "?a=dr&rid=" & URLEncode([Record ID#]);

    var text URLTHREE = "mailto:"& URLEncode([Email]);

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

    I'm not keen on opening a new page as it will get messy for the users.
    If I run $URLONE & & $URLTWO I update the activities and end up where I want to be.

    Once I add $URLTHREE something like:

    "&rdr=mailto%3customername%2540company.ac.uk"

    gets appended to the URL which then shows a blank page. 

    When I did try it with new page it shows the activities but the main page goes blank because of the mailto getting into the URL.  




  • 10.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 13:50
    I don't know if a solution to your situation.  Essentially you need to do two things at the same time, which is to redisplay the record and also to open a new page.

    what happens when you do this

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

    ie omit the URLTWO step.



     




  • 11.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 13:58
    Yes, I get an even longer URL.  This shows the URL from the first and third steps... And it shows a blank page as I suspect the MailTo gets in the way. 

    QBCOMPANY.quickbase.com/db/bn4dxunyy?a=API_AddRecord&_fid_148=9780&_fid_157=16726&_fid_7=Email%20Sent&_fid_142=11-05-2018%2001:52%20PM&apptoken=XXXXXXXXXXXXXXXXXXXX&rdr=mailto%3NAME%2540COMPANY.co.uk


  • 12.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Top
    Contributor
    Posted 11-05-2018 15:14
    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.


  • 13.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 15:45
    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.

    : / 


  • 14.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 16:05
    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. 


  • 15.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Top
    Contributor
    Posted 11-05-2018 16:20
    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.



  • 16.  RE: Can I use a formula URL button to create an email using an email client and redirect to the initial report?

    Posted 11-05-2018 16:24
    Thank you and will do : )