Forum Discussion

ChuckGrigsby's avatar
ChuckGrigsby
Qrew Cadet
7 years ago

Free script to send record values to mandrill email templates.

A scalable script to send values from a record to a mandrill(mailchimp) email template.
https://gist.github.com/chucksupport/56733f7671bcec0429d11e50061fc0ec#file-qbtomandrill


Instructions:
Requirement: IOL technique.
Requirement: Mandrill API key and QB apptoken

Configuration:
In the script you'll see an object like this. copy the object jobSheet or bookingTicket or rename them. For the fields you enter the exact name (no spaces) of your merge tag *|MERGE_TAG|* and the quickbase field ID of the field you want pushed to that tag in your email. More comments in the code below and in the script. If you need any help you can reach out directly
earn.com/chuck

fields:{MERGE_TAG:"123"}

var template = {


    jobSheet: {
        timestampField:"_fid_342", //the field on the form you want to timestamp when the email was sent.
        fields: {
            enterMailchimpMergeTagName: "123" //the id of the quickbase field
        },
        msgObj: {
            "template_name": "templateName" // the slug of the mailchimp template
            "template_content": [{
                "name": "Job Sheet",
                "content": "Job Sheet Information"
            }],
            "message": {
                "from_email": "FROM EMAIL",
                "to": "",
                "subject": "job sheet for ",
                "text": "Find your job sheet information below.",
                "merge": true,
                "global_merge_vars": [],
                "merge_vars": ""
            }
        }
    },

    bookingTicket: {
        timestampField:"_fid_341",
        fields: {
           

        },
        msgObj: {
            "template_name": "bookingticket",
            "template_content": [{
                "name": "Booking Ticket",
                "content": "Booking Ticket Information"
            }],
            "message": {
                "from_email": "FROM EMAIL",
                "to": "",
                "subject": "booking ticket for ",
                "text": "Find your booking ticket information below.",
                "merge": true,
                "global_merge_vars": [],
                "merge_vars": ""
            }
        }
    }
}



After its all setup then you would add a couple buttons on your form that trigger the mail().

in this example i want to send jobsheet so the button would have javascript:mail(template.jobSheet); return false;

again happy to answer any questions or if ya need assistance implementing it. Earn.com/chuck

5 Replies

    • ChuckGrigsby's avatar
      ChuckGrigsby
      Qrew Cadet
      I'm just using APIs for mandrill and QB. I'm sure it's possible but may be easier to just use this. Welcome to contact me if ya have questions. Earn.com/chuck
  • KellyBianchi's avatar
    KellyBianchi
    Qrew Assistant Captain
    Do you have to create buttons, or can this be triggered with notifications?

    • ChuckGrigsby's avatar
      ChuckGrigsby
      Qrew Cadet
      The way it's set up you have to use buttons. Let me know if you would like any help. Chuck.Support