Highlighted

AEM 6.3 Forms - How to email-attach a generated PDF on submit

fabioper85

11-09-2018

Hi everyone

I'm trying to solve this puzzle, but I can't get it!

I created an Adaptive Form from an XSD schema and I render as PDF through an XDP

Now, on submit, I want to store the generated pdf and also send it via mail as attachment

I followed the steps in this link

AEM 6.0 Forms Help | Writing custom Submit action for adaptive forms

Everything works, I only need to attach the generated file

I know that I have to use a MultiPartEmail, but I'm missing the remaining steps

Can someone help me?

Thanks a lot

Fabio

Replies

Highlighted

Mayank_Gandhi

Employee

11-09-2018

If you can render the AF in HTML, you may utilise the DOR option to obtain the data and leverage OOTB email submit action/Form Portal store as well.

Highlighted

Mayank_Gandhi

Employee

11-09-2018

Adding more to the suggestion. I have created 'test_fabio' as a sample form

1. Create an AF based on the XDP.

1569666_pastedImage_0.png

2. Bind the fields as required. 

1569667_pastedImage_1.png

3. Select the submit action to send PDF via email. For this configure the Day CQ Mail Service beforehand. The field names in an adaptive form are called placeholders that are replaced with the value of that field after a user submits the form. To define a placeholder, specify ${<field name>} in the respective field for ex ${email_addr} in the 'To' field.

1569671_pastedImage_2.png

Result:

1569672_pastedImage_3.png

The XDP template would be sent as PDF with the value populated from the bound fields.

1569673_pastedImage_6.png

Highlighted

fabioper85

11-09-2018

Thank you everyon for the answers, guys

I really appreciate!!

I have a question: the OOTB email send doesn't store the resulting PDF, right?

because I need also to store the pdf

thanks

Fabio

Highlighted

fabioper85

12-09-2018

sorry guyz, maybe I wasn't too clear with my question...my fault

try to be more specific

What do I mean by "store"?

We'd like to blend the Store PDF submissionType and the Send PDF via mail

in one SubmissionType

Nowaday...we can run the 2 actions separately, we need to connect

Maybe we need to create a Worflow???

Sorry for the (maybe) stupid questions... 😞

You guyz are great!

Fabio

Highlighted

Mayank_Gandhi

Employee

12-09-2018

Fabio,

You would need to create workflow here to perform both the steps. Not possible OOTB.

On the other hand, if you can store data in DB just submit the form to JEE workflow and let JEE process handle the form save and email action. This is in case you find Aem workflow challenging. Here you can use Jdbc service and Mail component provided in workbench to handle the AF data.