Discussions

Expand all | Collapse all

How do I create a button to initiate an email from Outlook?

QuickBaseCoach Dev./Training12-15-2014 21:52

QuickBaseCoach Dev./Training12-13-2017 04:42

  • 1.  How do I create a button to initiate an email from Outlook?

    Posted 08-30-2013 21:46
    I would like to create a button to add to a form that would initiate a standard email from Outlook to another QB user. The email should send a copy of, or a link to, the record being displayed in the form when the button is clicked. Is this possible?


  • 2.  RE: How do I create a button to initiate an email from Outlook?

    Posted 08-30-2013 22:15
    This is an example of a URL formula field to invoke the user's default mail client.  The are some lines commented out that would turn it into a formula-text field as an href type link.  But in the new UX when you click those on a report the record also opens up, which is most confusing to users.

    ... Anyways, here is an example.  You should URLEncode anything from a field that might have spaces or special characters.


    //"<a href=\

    "MailTo:customerservice@gesco.ca"

    // the above text invokes the mail client, and creates the TO line

    &"?subject=Quick Specials Order"

    // the above text does the subject line, below that is the body
    // the %0A is a line feed type indicator.

    &"&body=Attention SHNIER Customer Service, please order the following for me "
    &"%0A%0A"&[Specials List Category - Accessories Group]


    &"%0A"& URLEncode([Description])

    &"%0A"&"Item Code: " & URLEncode([ITEM#])
    &"%0A" & "Price is " & URLEncode([Price & Comment])
    & If([Cuts OK?]="OK", " (Price is $1.25 extra for cuts)")
    & If([Rolls Only?], " (no cuts allowed on this item)")

    &"%0A%0A" & "Qty is " & [Qty Available]  & " U/M is "  & [UM] & "  (Edit Qty as necessary)"

    &"%0A%0A" & "My Store name is :"
    &"%0A%0A" & "My Tel number is :"
    &"%0A%0A" & "My name is :"
    &"%0A%0A" & "My Purchase Order is:"
    &"%0A%0A" & "My Ship date is:"
    &"%0A%0A" & "Special Instructions:"

    // OK the URLEncode function is required because putting certain special
    // characters into the HTML messed it up.  So, since you can't directly
    // put an = or & into the string, you need to use the URLEncode function.

    &"%0A%0A" & "(Internal use information follows)"
    &"%0A" & "Locn: " & URLEncode([Location])
    &"%0A" & "Serial: " & URLEncode([Serial#])
    &"%0A" & "Shade: " & URLEncode([Shade])

    &"%0A%0A" & "Here is a Query for the Item in Quick Specials"

    &"%0A" &"https://gesco.quickbase.com/db/xxxxxxxx?a";
    & URLEncode("=")& "q" & URLEncode("&") & "qid"
    & URLEncode("=") & "65" & URLEncode("&") & "nv"
    & URLEncode("=")  & "1" & URLEncode("&")
    & "v0"& URLEncode("=") & "Item" & URLEncode([ITEM#])

     
    // This last bit creates the words for the link that you click.

    //&"\">"&"<b>Order by Email"&"</a>"


  • 3.  RE: How do I create a button to initiate an email from Outlook?

    Posted 10-31-2018 05:00
    Mark_Shnier,

    I copied and pasted your code into the URL formula field but the mailto keeps popping up as an error (see below). Can you please help me fix this problem? Thanks!




  • 4.  RE: How do I create a button to initiate an email from Outlook?

    Posted 10-31-2018 13:16
    This works:

    // create 3 text variables then execute them in order

    // first variable holds the email address & content

    var text URLONE = "MailTo:" & URLEncode([EmailAddressFieldName])

    &"?subject=TYPE YOUR SUBJECT HERE"

    &"&body=TYPE THE BODY OF YOUR EMAIL HERE, IF YOU INCLUDE FIELDS, DO IT LIKE THIS:�

    & URLEncode([FieldName])

    & "MORE EMAIL BODY UNTIL YOU�RE DONE, THE NEXT BIT IS HOW TO CREATE CARRIAGE RETURNS IN THE EMAIL BODY:"

    &"%0A"  // this makes a carriage return

    &"%0A";  //make sure to include the semicolon to end the variable declaration statement

     

    // this is a little bonus, it checks a box on the record that indicates you�ve sent the email (so you remember not to send it twice)

    var text URLTWO = URLRoot()

    & "db/"

    & Dbid()

    & "?act=API_EditRecord&"

    & "rid=" & URLEncode([Record ID#])

    & "&_fid_91=1"; // this is the checkbox field ID, and you set it to equal 1, which is TRUE or Checked

     

    // this re-loads the page when you�re done

    var text URLTHREE = URLRoot()

    & "db/"

    & [_DBID_CAMPAIGNS] // replace with your table ID name

    & "?a=dr&rid="

    & [Related Campaign]; // id of the table you�re redirecting to (the button on this case was on a child record, therefor the �related� part...

     

    // this �runs� the script: checks the box, then reloads the page, then sends the email, in that order

    $URLTWO

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

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




  • 5.  RE: How do I create a button to initiate an email from Outlook?

    Posted 10-31-2018 14:15
    Michael,

    I copied your code and I got a syntax error below. The code seems right to me but not sure why it is not working. I am using formula URL type. Is it a type that I am supposed to use?

    ">https://d2r1vs3d9006ap.cloudfront.net/s3_images/1759838/RackMultipart20181031-116518-okz3hb-Capture50_inline.PNG?1540995293">

    Please help. Thanks for the code!!


  • 6.  RE: How do I create a button to initiate an email from Outlook?

    Posted 10-31-2018 14:17
    @sales info, please do not post code by a screen shot.  no one can read it and its not editable.

    If you have a syntax error, post the code by copy and paste of the code, and also post the error message which includes the underlining.


  • 7.  RE: How do I create a button to initiate an email from Outlook?

    Posted 10-31-2018 18:09
    Michael,

    I created 3 variable called email1, email2, email3. I am having a problem with the second variable. Can you please check my variables below. Also, what Do I need to do next after creating three variables?



    The first variable: email1 

    var text URLONE = "MailTo:" & URLEncode([Email])  &"?subject=THIS IS A TEST"  &"&body=TYPE THE BODY OF YOUR EMAIL HERE. THIS IS A TEST"
    &"%0A"    &"%0A";  
    var text URLTWO = URLRoot()  & "db/"  & Dbid()  & "?act=API_EditRecord&"  & "rid=" & URLEncode([Record ID#]) //DO I HAVE TO CHANGE [Record ID#]?  & "&_fid_91=1"; 

    The second variable: email2 

    var text URLTHREE = URLRoot()

    & "db/"

    & [_DBID_TICKETS]  // THE TABLE IS CALLED "Tickets"

    & "?a=dr&rid=" & [Related Campaign]; // I DON'T GET THIS PART. IS IT THE ID OF THE TICKET table // How do I know the ID number for the tickets table? The third variable: email3

    $URLTWO

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

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


    After creating three variable above, what am I supposed to do next? How do I create a button on the ticket table?

    Please help. Thanks so much!!





  • 8.  RE: How do I create a button to initiate an email from Outlook?

    Posted 09-09-2013 21:28
    Thank you very much! Was able to figure out 97% of what I need to do :)

    Two remaining questions:
    1. Is it possible to have QuickBase look at my Program Manager field to get the "To" info for the email?

    2. What do I put at the end of the sentence below to create a link back to the record from which the email was initiated?
    Please contact me about this record: (this is where I'd like to have a link back to the record)

    Thank you again!


  • 9.  RE: How do I create a button to initiate an email from Outlook?

    Posted 09-09-2013 21:36
    no problem

    Create a Formula email field [Program manager email] with the formula UsertoEmail([program manager]) and include that in the Mailto like

    "MailTo:" & URLEncode([Program manager email])

    I'm not sure if you need to URLEncode it, but it shouldn't hurt just in case the @ in email addresses is an illegal character.

    As for the last part you should be able to simply have a line like

    &"%0A%0A" & "Please contact me about this record "
    & URLEncode (URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [record ID#])


  • 10.  RE: How do I create a button to initiate an email from Outlook?

    Posted 09-09-2013 21:52
    THANK YOU, THANK YOU, THANK YOU!!!
    That did it! :)


  • 11.  RE: How do I create a button to initiate an email from Outlook?

     
    Posted 11-20-2014 21:54
    Mark,
    how do i embed a form in the email i'm generating? i understand how to embed the form (showing the buttons and fields) in a regular QB notification, but what about this notification that's being generated directly in Outlook?

    i've created the button to allow people to "Approve" or "Reject" and tried using the API_Authenticate but i'll have to work on that some more because i'm getting errors. How do i make the hyperlink display in a button like it does within QB???


  • 12.  RE: How do I create a button to initiate an email from Outlook?

    Posted 11-20-2014 22:28
    I do not know of a way to send anything other than basic text in a MAILTO: button.  I do not claim to be an expert in MAILTO formatting, but I'm under the belief that the MAILTO is like the lowest common denominator for causing an unknown random "Mail client" to pop up a window.  It could end up being Outlook or a gmail webmail screen or whatever the default mail client is for the random user who clicks that link.  Since the mailto does not know who will be clicking it, its very basic.

    My suggestion is to reconsidering using the built in email Notifications and giving the user a way to specify the email addresses and to manually trigger the email.


  • 13.  RE: How do I create a button to initiate an email from Outlook?

     
    Posted 12-04-2014 15:36
    how do i add an address to the "CC" line? i've tried this:
    "MailTo:name@domain.com?cc=othername@domain.com"&
    "?subject=test email"

    which results in "name@domain.com" going into the "To:" line as needed, but everything else goes into the "cc" line (including the ? before subject=test email.


  • 14.  RE: How do I create a button to initiate an email from Outlook?

    Posted 12-04-2014 16:09
    Se if this helps.  its just a random google on "mailto syntax", but  think it has your answer. http://www.labnol.org/internet/email/learn-mailto-syntax/6748/


  • 15.  RE: How do I create a button to initiate an email from Outlook?

     
    Posted 12-04-2014 16:18
    that's a good one, but it doesn't help me with the error i'm getting in the QB formula button.

    even when i type:
    MailTo:name@domain.com?cc=othername@domain.com?subject=subjectline
    in the browser it generates an email that looks like this:

    To... name@domain.com
    Cc... othername@domain.com?subject=subjectline


    i must be missing something between the "othername@domain.com" and the "?subject=..." pieces.


  • 16.  RE: How do I create a button to initiate an email from Outlook?

    Posted 12-04-2014 16:36
    I played with it and I think that the issue is that there can only be on "?"  Typically the ? means " and here are all the parameters.
    try this


    "<a href=\"MailTo:"&[Emails for carrier and others separated by semi colons]

    // the above text invokes the mail client, and creates the TO line

    & "?cc=test@test.com"

    &"&subject="
    &[Carrier Subject Line] & " for Trailer " & [Trailer / Container #]

    // the above text does the subject line, below that is the body
    // the %0A is a line feed type indicator.

    & "&body=" &[Carrier Body Header]


  • 17.  RE: How do I create a button to initiate an email from Outlook?

     
    Posted 12-04-2014 16:38
    fantastic. i started copying and pasting like a crazy man and randomly discovered that if i only put the ? before the "cc" and then used "&" for each line of stuff it worked.

    thanks so much for your help on this one. i didn't know what the ? meant, but now i do and it makes much more sense.


  • 18.  RE: How do I create a button to initiate an email from Outlook?

    Posted 12-04-2014 16:40
    Its actually similar to quickbase urls, they define a path and then they always have a  ? and the rest is parameters telling it what ti do.


  • 19.  RE: How do I create a button to initiate an email from Outlook?

     
    Posted 12-15-2014 15:45
    how do i make QB return to the record after initiating the MailTo fuction?
    when i'm editing the record i click the button and i'm advised to save my record first. Outlook opens correctly, but my QB form goes to a blank page.


  • 20.  RE: How do I create a button to initiate an email from Outlook?

    Posted 12-15-2014 21:52
    Can you post your current formula?


  • 21.  RE: How do I create a button to initiate an email from Outlook?

     
    Posted 12-15-2014 22:08
    "MailTo:user1@domain.com"

    &"?cc=user2@domain.com; user3@domain.com; user4@domain.com"


    &"&subject=Subject - "&[field name] &" - Site #: "&URLEncode([Site #])&" - Site Name: "&URLEncode([Site Name])

    &"&body=user1,"&"%0A%0A"&
    "Please send package for this site to:"&"%0A%0A"
    &[Address]


  • 22.  RE: How do I create a button to initiate an email from Outlook?

    Posted 12-15-2014 23:29
    not tested, but try this.

    var text URLONE = "MailTo:user1@domain.com"
    &"?cc=user2@domain.com; user3@domain.com; user4@domain.com"
    &"&subject=Subject - "&[field name] &" - Site #: "&URLEncode([Site #])&" - Site Name: "&URLEncode([Site Name])
    &"&body=user1,"&"%0A%0A"&
    "Please send package for this site to:"&"%0A%0A"
    &[Address];

    var text URLTWO =
    urlroot() & "db/" & dbid() & "?a=dr&rid=" & totext([record id#]);

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


  • 23.  RE: How do I create a button to initiate an email from Outlook?

    Posted 12-13-2017 04:02
    Is it possible to embed a table of child records when creating an email like this?


  • 24.  RE: How do I create a button to initiate an email from Outlook?

    Posted 12-13-2017 04:42
    No. I don�t think so.