Expand all | Collapse all

Send Email"" Button with custom text and fields

  • 1.  Send Email"" Button with custom text and fields

    Posted 11-09-2017 03:46
    I know that there are lots of posts on email generation; I've read many, many of them and still have not found a clear explanation of a solution for what I'm trying to do (i.e., with specific URL formulas etc.).

    I have a project tracking database.  When all of the data for a new project is created, I need a button, call it "Send Project" that generates a custom email to an email address included as a field in the main form. 

    The basic email notification triggers do not work. I don't want it to send upon addition/deletion/modification of the record.   I've tried to use a toggle field "ReadyToSend", to trigger the form when checked, but could not get that to work.  That said, I do like the ability of custom notifications to combine custom text and form fields.  

    I've tried my hand at URL-Formula button in its simple form, like this:

    URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & ToText([Record ID#]) & "&dfid=10"

    but that has two problems. It simply invokes the Mail interface, and requires me to address the email (which is limited to registered users; the intended recipient is not a Quickbase user).  Second, it sends the whole record (which logically follows from the foregoing).

    The text of the email should be something like

    Our Ref. No.: [Our Matter]
    [Receipient Name]:
    Attached you will find a project for [Client]..
    <other text and fields>
    Please complete the project by [Due Date]...

    So is this done via a Notification? A Form? a Button/URL? A combination of these?  
    Can you provide the prototype syntax?



  • 2.  RE: Send Email"" Button with custom text and fields

    Posted 11-09-2017 04:14
    You can use script attached to a button to send an on-demand email with custom toList, subject, message and reference an arbitrary record, and from id.

    Here is a screenshot of me manually applying the relevant code from the console:

    and here is a screenshot of the received email:

    Here is the raw code:

    Pastie Database

    To the extent you want to insert field values into the toListsubject, or  message you can do this by a variety of means from passing formula variables to the script or performing an AJAX request for the field values. 

  • 3.  RE: Send Email"" Button with custom text and fields

    Posted 11-09-2017 04:22

    This can easily be done totally natively, but I post a response in the morning.

  • 4.  RE: Send Email"" Button with custom text and fields

    Posted 11-09-2017 06:54
    Thanks, I look forward to it. I've read your other posts already, including your tutorial on URL formulas, and was hoping you'd answer.

  • 5.  RE: Send Email"" Button with custom text and fields

    Posted 11-09-2017 15:32
    OK, so this is easy stuff,

    Set up a field to trigger the notification on.  I suggest a field type of date/time.  Call it [Date Notification Sent]

    Create and Open Notification.  There are two types of Notifications. 

    "Recipient" only will go to users and it respects all permissions.
    "Open" goes to any email address(es).

    If you do not see the option at the very top of the setup for an open Notification, then you need to contact Quick Base support to have you enabled as they seem to default new accounts to disable that for security reasons.

    The Subject and body can have any mixture of words and fields.

    If there are multiple email address you need to send to at the same time, you choose "a specific list" as the recipient and then the email address fields can just be listed in the box and carefully hand typed typed like this

    [email address 1]
    [email address 2]
    [email address 3]

    OK, so you can test that by manually edit the date time field and it will trigger.

    Then to make a button you will need a formula URL field.

    The URL part is easy

    var text URL = URLRoot () "db/" & dbid() and "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_99=" & Totext(Now())
    & "&apptoken= xxxxxxxxxxx;

     "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    & "void(0);"

    so that defines a formula variable called URL.  The URL just says to edit the record and put the current date and time into field ID 99.  You will need to change the 99 to the fid of your date/time field.

    The apptoken will be required is your app has the requirement for app tokens enabled.  You may want to turn that requirement off.

    That last crazy javascript stuff is always standard (If you name your formula variable URL) and you do not need to understand it.  All it does is to execute the URL and refresh the page.  It does hide any error messages though, so if the button does not work, then comment out that javascript stuff or remove it and just put $URL where it was.  That will run the URL and expose any error messages to you.

    Let me know how it goes.


  • 6.  RE: Send Email"" Button with custom text and fields

    Posted 11-09-2017 16:02
    I will try this, thank you

  • 7.  RE: Send Email"" Button with custom text and fields

    Posted 11-09-2017 15:35
    It's not very often I get to answer questions instead of ask. But I just did something similar to what you are asking this week!

    I have a document that I send out as a PDF to multiple customers per day. I use an email template, but it's kind of a pain to get to. So I wanted a button that would essentially create this template for me. So I set up a button that will fill in the Subject and Body of the message. 

    To start I was able to use the app already built on the exchange to test. That app is called "Tutorial: One click button for outlook". This is a great example of what I needed, although I needed modifications to meet my needs. I would suggest looking at that app though, it was very helpful. 

    Basically, on the page I'm sending the email from I added a couple new fields. Two formula text fields called [Subject] and [Body], and a formula URL called [Send Email] which will end up being the button. 

    In the [Subject] field I simply set up the text I wanted to be in the subject. My subject included a value from a field so I used a formula text field for this. If you don't need data from a field in the subject you could just use a regular text field and set the default text.  Here is a screenshot of what it looks like for me. 

    In the [Body] field I set it up to be laid out how I want. If you need line breaks you will have to use %0D%0A in the formula to include them. So below is what that formula looks like

    Finally, in the [Send Email] field you put in the code needed to put this all together in your email client. You can also add a [To] field to auto fill in the recipients of your email as well. See below what I have in my formula. Be sure to put what you want the button to say in the [Link Text] field, and to check the "Display as button..." checkbox.

    Finally, you should be able to add the button to your form and test. Here is a screenshot of what I get when I press the button. My email client auto-populates my signature (I've removed most of it from this image) and I can make any changes necessary before sending. 

    Sorry for the long explanation, I wanted to provide as much detail as possible. Hope this helps!

  • 8.  RE: Send Email"" Button with custom text and fields

    Posted 11-09-2017 15:41
    So just to explain further, Adreonna's solution will cause say Outlook or gmail to open up (what ever your default mail client is) and prefill the email for you to then manually send.

    My posted solution will email from QuickBase.  Note also that you can set the "from" to come from the Last Modified by so the recipient can reply to your email.  To see that option you need to set the notification to trigger on single record changes only. 

  • 9.  RE: Send Email"" Button with custom text and fields

    Posted 11-09-2017 19:23
    thanks to both of you for alternative examples. I like Aredonna's solution because it essentially mirrors my exact work flow.  I'll give that a shot.   Mark, your solution I can use in other ways for emails that I'll send directly.

  • 10.  RE: Send Email"" Button with custom text and fields

    Posted 12-26-2018 17:00
    Hello, I tried "QuickBaseCoach App Dev./Training" solution and it works perfectly. However, I need to have a file from a file upload field as an attachment and I can't get that to work. I can have a link to the file in the email notification but cannot have the file as an attachment. I need to have the file as an attachment because I have a rule on my mail server that save attachments from some emails and automatically save them in a folder that is archived on my cloud server. Is it possible to accomplish that?

  • 11.  RE: Send Email"" Button with custom text and fields

    Posted 12-26-2018 17:48
    Quick Base will not natively send an email with an attachment.  You can however, trigger an email with a link to an attachment that can be viewable without needing to sign into Quick Base, ie for outside recipients without a Quick Base userid.

    If you absolutely need to be able to trigger an email and include an attachment which is stored as a file attached to a Quick Base record, there are 3rd party solutions like this one from Juiced which will do that.  


  • 12.  RE: Send Email"" Button with custom text and fields

    Posted 12-26-2018 17:59
    Thank you! I already work with JuicedTech for Exact Form+ and DocuSign so I will contact them.