How to send different number of PDFs through email conditionally?

  • technicalreports
    Asked on September 16, 2024 at 2:18 AM

    Hi


    Is it possibe to have 2 different PDF upon Submission.

    First is the Default one.

    Second should be based on condition.

    If REGION contains USA only then 2nd PDF should be created.


  • Raymond JotForm Support
    Replied on September 16, 2024 at 2:51 AM

    Hi technicalreports,

    Thanks for reaching out to Jotform Support. Yes, this is possible. There are two ways to do this. First, you can have an email template with two PDF reports attached and send it conditionally, while having another template that has one PDF report attached and is also sent conditionally.

    Alternatively, you can have two email templates with each PDF report, and have them sent separately and conditionally.

    If you need further help, please share with us a bit more details on the flow you're trying to create so we can show you an example. For example, which email templates are you trying to use, and the email addresses for each condition. In the meantime, please check out our guides on How to Send an Email Based on a User's Answer and How to Attach Submissions as PDFs to Email Notifications.

    Reach out again if you have any questions.

  • tonybenjamin1209
    Replied on September 16, 2024 at 3:03 AM

    To generate two different PDFs upon submission, you can follow these steps:

    1. Form Submission Handling: When the user submits the form, check the value of the REGION field.
    2. Generate Default PDF: Use a PDF generation library like FPDF or TCPDF to create the first PDF for all users.
    3. Conditional Check: If the REGION contains "USA," generate the second PDF with the appropriate content.
    Example Pseudocode:

    def on_form_submission(form_data):

      # Generate default PDF

      generate_default_pdf(form_data)


      # Check REGION

      if "USA" in form_data['REGION']:

        # Generate second PDF

        generate_second_pdf(form_data)


    def generate_default_pdf(data):

      # Logic to create and save the default PDF

      pass


    def generate_second_pdf(data):

      # Logic to create and save the second PDF

      pass

    By implementing this method , you can create two PDF files based on the specified condition.

  • technicalreports
    Replied on September 16, 2024 at 8:51 AM

    I am unabel to see the 2nd PDF option in EMAIL - - - ->> ADVANCED.How to send different number of PDFs through email conditionally? Image 1 Screenshot 20

  • Mary Eden JotForm Support
    Replied on September 16, 2024 at 9:17 AM

    Hello Technical Reports,

    I looked at the link to your form, and the reason you couldn't see the second PDF option is that your PDF in the PDF editor only shows one. To ensure that you will be able to see another PDF in your email, you will need to add the second PDF. Let me show you how it's done:

    1. In Form Builder, click on the Downward Arrow icon at the top-left side of the page and select PDF Editor.

      How to copy a pdf report layout from one form to another? Image 1 Screenshot 63 Screenshot 41 Screenshot 30
    2.  In PDF Editor, click on the +New PDF tab. Then, when the window shows up, click on the Use Default Layout.
    3. Then, update the PDF based on your preference.
      How to send different number of PDFs through email conditionally? Image 1 Screenshot 41

    Check out the screencast below to see my results:

    How to send different number of PDFs through email conditionally? Image 2 Screenshot 52

    If you run into the same issue, let us know, and we'll do some more testing to see what's going on. We also have a guide about How to Customize a PDF Submissions Report that you can check out.

    Keep us updated and let us know if you need any more help. 

  • technicalreports
    Replied on September 16, 2024 at 12:16 PM

    Unable to delete one option in 2nd PDF Editor.

  • technicalreports
    Replied on September 16, 2024 at 12:25 PM

    Unable to delete one option in 2nd PDF Editor.How to send different number of PDFs through email conditionally? Image 1 Screenshot 20

  • Christopher JotForm Support
    Replied on September 16, 2024 at 12:27 PM

    Hi technicalreports,

    I have cloned your form and tested it on my end, and I was able to delete an element on the PDF Document as shown in the screen recording.

    How to send different number of PDFs through email conditionally? Image 1 Screenshot 20

    It would help us to understand what’s happening if you could take a video recording with Loom and share the video link here with us.

    Once we hear back from you, we'll be able to help you with this.

Your Answer