How to send PDF attachments based on a field's selection?

  • Amanda
    Asked on August 22, 2017 at 5:26 PM

    Hello, I need to create a form that allows the user to check off which PDF files they want to download and then be sent the correct files or download links. I was trying to use conditional logic to achieve this, but I am running into the issue of how to connect the checkboxes to the files and get that into the email the person receives.

    Any idea how to do this?

    Thank you!

  • Mike_G JotForm Support
    Replied on August 22, 2017 at 7:11 PM

    We will be glad to help you with your concern, and there are ways for you to be able to achieve this.

    First, send the PDF file as autoresponder attachment.

    You need to create multiple email autoresponders for this workaround — Setting-Up-an-Autoresponder-Email

    Then, have those autoresponders be sent conditionally based on respondent's answer or selection — How-to-send-to-a-specific-email-address-based-on-a-selection

    In each autoresponder attach the different PDF file.

    How to send PDF attachments based on a fields selection? Image 1 Screenshot 50

    Second, send the download PDF link as part of the email autoresponder content.

    To do this, add the Multiple Choice Field (checkbox field) with options (the titles of PDF files) to your form and set calculation values to each option following this guide — How-to-Assign-Calculation-Value.

    The calculation value of the options are the download links.

    How to send PDF attachments based on a fields selection? Image 2 Screenshot 61

    Then, pass whatever value(s) is selected in the checkbox field to another field (textbox or textarea field) using conditions following this guide — Conditional-Logic-Inserts-Text-Calculation-Into-A-Field

     

    How to send PDF attachments based on a fields selection? Image 3 Screenshot 72

    Note: I used a Long Text Entry Field (Textarea field) to hold the download link(s) of the selected PDF file(s). You can hide that field from the form, but include it in the email autoresponder content.

    How to send PDF attachments based on a fields selection? Image 4 Screenshot 83

    If you have other questions regarding this or you need any clarifications, please feel free to contact us again anytime.

  • Amanda
    Replied on August 23, 2017 at 11:30 AM

    Hi Mike, thank you so much for your help.

    Another quick question related to this - how did you get the link for the attachment? Once I upload it, I don't see a way to grab the direct link in order to put that in the calculation field.

    Thank you.

  • Amanda
    Replied on August 23, 2017 at 11:49 AM

    One more question, thank you for your patience. In order to prevent the other autoresponders from sending a bunch of emails, what is the best method? Since I only need the main responder to send, that is. Thank you!

  • David JotForm Support Manager
    Replied on August 23, 2017 at 12:53 PM

    Where are you uploading the attachments? You may upload the files to your Google Drive account, and get the download links from there: https://sites.google.com/site/gdocs2direct/ 

    You may delete the autoresponder you don't need. Let us know if you have more questions.

  • Amanda
    Replied on August 23, 2017 at 2:32 PM

    Hi, that is just adding the links into the email, not attaching the items to the email. The original response seemed to be a way to get the PDFs to attach, but I just need the source links (from the autoresponder attachments) to put into the calculation fields. How do I retrieve those links?

  • David JotForm Support Manager
    Replied on August 23, 2017 at 2:49 PM

    The PDF files will be attached in the autoresponder, as my colleague explained:

    How to send PDF attachments based on a fields selection? Image 1 Screenshot 20

    But, if you also want to show the links to those files inside the email notification content, you need to upload those files to your own sever, or any third party storage service such as Google Drive, and get the links from them.

  • Amanda
    Replied on August 23, 2017 at 2:59 PM

    Hello, I think we're talking about separate things. How to send PDF attachments based on a fields selection? Image 1 Screenshot 50I attached a screenshot to help explain. I need several different attachments to go into one email, but the person filling out the form decides which ones. Here is the form: How to send PDF attachments based on a fields selection? Image 1 Screenshot 50https://form.jotform.us/7233594084How to send PDF attachments based on a fields selection? Image 1 Screenshot 503156

     

    How to send PDF attachments based on a fields selection? Image 4 Screenshot 83

     

  • Mike_G JotForm Support
    Replied on August 23, 2017 at 4:14 PM

    We understand that you would like to send PDF attachments to your respondents based on their selection in a field. We also understand that you would like to have the links to those attachments to be included in the email content of the autoresponders. However, if what you would like to get is the download link of the file you uploaded via the Attach a File option of the email autoresponder under Advanced tab and have it as a calculation value of an option of the Multiple Choice Field in your form, I would like to apologize for there is no way we can get the download link of the file you uploaded since that is saved internally.

     

    Also, I would like to apologize, after testing the workaround I provided to you above, I noticed that emails are just reading the links from the selected option as one link which will result in an invalid link.

    To fix that, may I suggest instead of using a Multiple Choice Field (checkbox field) to ask your respondents which case studies would they like to do download, please use an Input Table field instead.

    You can also set calculation values with the Input Table field.

    How to send PDF attachments based on a fields selection? Image 1 Screenshot 40

    The difference is you have the option to separate the download links in the calculation condition.

    How to send PDF attachments based on a fields selection? Image 2 Screenshot 51

    Result:

    How to send PDF attachments based on a fields selection? Image 3 Screenshot 62

    If you have other questions or concerns, please feel free to contact us again anytime.

  • Amanda
    Replied on August 23, 2017 at 5:04 PM

    I've tried updating this, but I am still not getting the attachments. I just get a list of links in the email. Not sure what I am doing wrong, but thank you for your patience! Would you mind taking a look again?

     

    Also, something is changing part of the Google link when it gets sent out, so I switched it to Dropbox.

  • Mike_G JotForm Support
    Replied on August 23, 2017 at 7:39 PM

    I would like to apologize for any inconvenience, however, I'm not sure if there is a possible way to make the download links in the email content to automatically appear as attachments in email alerts. And we do not have such feature yet. In the last screenshot I provided above, the attachments appeared because the links are uploaded in Google Drive which is the same host as my email address, Gmail.