Confiforms - Create Attachment and email it on Creation
Asked by Drew T:

Hi,

I'm trying to use an IFTTT macro to create an attachment 'on Creation ' {iftttResult_attachmentMacro}, containing the form inputs and then use another IFTTT to send an email with the created attachment attached.

Appreciate advice on the best way to achieve this.

I have added a field definition 'requestAttachment' to the form of type file/Attachment

I have tried using an IFTTT macro to Create / update Confiforms entry with params entryId=entry.id\&requestAttachment={iftttResult_attachmentMacro}

I have also tried using a confiform Rule definition to Set the Value of the requestAttachment field to \[entry.requestAttachment\].

So far neither method has worked.

I understand I need to add the requestAttachment field to the Send Email macro but first I need to get the attachment field to populate.

[@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) are you able to help with this one?

Thanks,

Drew


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Drew T](/t5/user/viewprofilepage/user-id/4734306)

Have a look at this [tutorial page](https://wiki.vertuna.com/display/CONFIFORMS/Creating+a+file+with+calendar+invitation+-+ics+file+in+Confluence+and+sending+it+via+email+with+ConfiForms)

It does exactly what you are looking for - creates an attachment on the fly, attaches it to page and then sends an email with the attachment to the user

Alex

comments: author: Drew T
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) ,

Thanks for sending that info through. I finally got back to this task and whilst I can get it to work as expected when I'm generating a plain text or html attachment, I get the following error with pdf's, both when trying to open them from the Confiform record and from the IFTTT generated email that the file was attached to.

"Adobe Acrobat could not open filename.pdf because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)"

In the field of type 'File/Attachment', I have the 'Accepts: field' as 'application/pdf' and in the IFTTT macro that creates the Attachment on creation also has the file Content type (mime type) field as 'application/pdf'. The file name also seems to generate correctly e.g. filename.pdf

In the body of the IFTTT macro I have tried entering the attachment content (user inputs as entry. notation) directly and both embedded in No Format and HTML macros. Each time I get the above error.

Appreciate if you could provide some advice to resolve this,

Thanks.


author: Alex Medved _ConfiForms_
body: Hi

Adobe Acrobat is a binary format that is impossible to create from a text file without some extra step, such as converting the text to binary/pdf

ConfiForms IFTTT could create a **text (html, yaml, csv)** attachment for you.

Alex


author: Drew T
body: Thanks Alex,

Do you know a way to do this using an IFTTT with some JavaScript? E.g convert the text to binary/pdf then attach the output to another file field definition? Then that field could be added to emails etc?


author: Drew T
body: [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) or any other method you can think of?


author: Alex Medved _ConfiForms_
body: ConfiForms app cannot create a PDF for you

It is simply of of the scope of the functionality our app has.

It is a very large and complicated topic


Tags: confiforms

confluence-server

server