How to start an Outlook email when clicking a button

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Hey All,

I thought this would be simple but it appears to be a bit more complicated, hoping you could help out.

I have a button called email in our Contact app that generates a new activity, as well as changing the field Activity type to Email.  Simple formula.  

What I thought would be cool and make this more useful would be if the button also started a new email to the Contact Email address, but starting a new Outlook email.  No specific subject or body required, just a new email with the contact email address in the to: field.  However, despite much searching, this appears to be more difficult than it seems!

Here is the formula

URLRoot() & "db/" & [_DBID_ACTIVITIES] & "?a=API_GenAddRecordForm&_fid_11=" & URLEncode ([Record ID#])

& "&_fid_6=E-Mail"

& "&z=" & Rurl()

Can this be done?  Is it not as easy as I thought it should be?

Thanks for the assist!

Michael Custer

Photo of Michael

Michael

  • 20 Points

Posted 3 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,620 Points 50k badge 2x thumb
not tested, but try this. I am making the assumption that the Parent record already contains the email address field.

var text AddChild = URLRoot() & "db/" & [_DBID_ACTIVITIES] & "?a=API_GenAddRecordForm&_fid_11=" & URLEncode ([Record ID#])
& "&_fid_6=E-Mail";

var text OpenOutlook = "mailto:" & [My email address field];

$AddChild
& "&nexturl=" &URLEncode($OpenOutlook)
Photo of Michael

Michael

  • 20 Points
Hey Mark.  Unfortunately not.  I am not really certain, but I don't know if the mailto function is working for me.  I can click on an email address and it opens Outlook, but making it generate one from a button just doesn't seem to go.  Very odd indeed.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,620 Points 50k badge 2x thumb
What happens when you tried my suggestion?
Photo of Michael

Michael

  • 20 Points
What keeps happening, no matter how I change the formula, is that it puts the mailto information into the fid6 field... so instead of the button changing the Activity type to Email (as it should), it inputs the mailto information.  Somehow, this is the issue.  I have tested with a dummy button that mailto is working (so that silly statement is out!), so I think solving that bit of syntax is the answer... make the formula say do this, stop, then do this.  Make sense?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,620 Points 50k badge 2x thumb
Can you post your formula?  I tested mine and it works. Set the field to Open in new window.
Photo of Michael

Michael

  • 20 Points
Here you go.  I also tried to add just your var text portion to the formula and get the same result.  
After clicking the button, in the Activity type field, I get E-Mailmailto:blahblah.  I'm fairly certain that your formula was correct.  I think what needs to happen is for there to be some type of break after the line & "&_fid_6=E-Mail", but I have never seen or heard of that before.

URLRoot() & "db/" & [_DBID_ACTIVITIES] & "?a=API_GenAddRecordForm&_fid_11=" & URLEncode ([Record ID#])

& "&_fid_9="&URLEncode([Related Vendor])

& "&_fid_6=E-Mail"

& "mailto:" & URLEncode([Contact - E-Mail Address])

& "&z=" & Rurl()

Thanks again!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,620 Points 50k badge 2x thumb
Well. What can I say? You asked a question and I gave you an answer. But then you did not use my answer and are asking why it's not working.

So my suggestion is to use my answer.
Photo of Michael

Michael

  • 20 Points
Sorry we're not meeting up on this one.  I did use your formula but didn't get the desired results.  I tried to mix and match my previous formula with yours as well, but couldn't seem to get things to work as I wished.
I do appreciate your help.
Thanks
Michael Custer
Photo of Michael

Michael

  • 20 Points
Hey Mark, I realized I made a user error!  So your formula IS working, but not until AFTER I save the record!  Then it did generate the email.  The only issue is with the redirection, which I think I can work on.

Thanks!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,620 Points 50k badge 2x thumb
Good to hear. As far as the redirection, I'm not quite sure what you mean but I suggest setting the field to "Open in new window".