Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

In this tutorial you will learn how to include your ConfiForms File fields into the email as attachments and send it out

This tutorial is based on the Creating embedded form with ConfiForms to send emails directly from Confluence tutorial and extends it with one field. Please start with mentioned tutorial and then continue here

Excerpt Include
Creating a simple form in Confluence with ConfiForms
Creating a simple form in Confluence with ConfiForms
nopaneltrue

Our from from Creating embedded form with ConfiForms to send emails directly from Confluence tutorial will get a new field of type file
This is done by placing ConfiForms Field Definition macro into the ConfiForms Form body and selecting "File" as it's type. We will name the field as "myattachment"
And adding a ConfiForms Field macro referencing the file field (myattachment) to the IFTTT macro body

The complete configuration for the form looks like this (or see alternative on the right)

Alternative via "[entry.fieldname]" notation:

Warning

Please see the following if the notation get's autocompleted into the link: https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+FAQ#ConfiFormsFAQ-WhyintheeditorIgetautolinksinsteadof[entry.field_name]notations

Now, when the IFTTT action is fired to send the email message the field "myattachment" get's added as file attachment to the email message.


The complete storage format for the solution is included below

Code Block
<ac:structured-macro ac:name="confiform">
  <ac:parameter ac:name="saveButtonLabel">Send</ac:parameter>
  <ac:parameter ac:name="formName">mailman</ac:parameter>
  <ac:parameter ac:name="registrationFormTitle">Send email</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:name="confiform-field-definition">
        <ac:parameter ac:name="type">text</ac:parameter>
        <ac:parameter ac:name="fieldName">recipient</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Recipient</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:name="confiform-field-definition">
        <ac:parameter ac:name="type">text</ac:parameter>
        <ac:parameter ac:name="fieldName">title</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Title</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:name="confiform-field-definition">
        <ac:parameter ac:name="type">textarea</ac:parameter>
        <ac:parameter ac:name="fieldName">messageBody</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Message body</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:name="confiform-field-definition">
        <ac:parameter ac:name="type">file</ac:parameter>
        <ac:parameter ac:name="fieldName">myattachment</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Attachment</ac:parameter>
      </ac:structured-macro>
      <ac:structured-macro ac:name="confiform-entry-register">
        <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
        <ac:parameter ac:name="embedded">true</ac:parameter>
        <ac:rich-text-body>
          <p>&nbsp;</p>
        </ac:rich-text-body>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:name="confiform-ifttt">
      <ac:parameter ac:name="title">[entry.title]</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="action">Send Email</ac:parameter>
      <ac:parameter ac:name="who">[entry.recipient]</ac:parameter>
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:name="confiform-field">
            <ac:parameter ac:name="fieldName">messageBody</ac:parameter>
          </ac:structured-macro>
        </p>
        <p>
          <ac:structured-macro ac:name="confiform-field">
            <ac:parameter ac:name="fieldName">myattachment</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>
Code Block
<ac:structured-macro ac:name="confiform">
  <ac:parameter ac:name="saveButtonLabel">Send</ac:parameter>
  <ac:parameter ac:name="formName">mailman</ac:parameter>
  <ac:parameter ac:name="registrationFormTitle">Send email</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:name="confiform-field-definition">
        <ac:parameter ac:name="type">text</ac:parameter>
        <ac:parameter ac:name="fieldName">recipient</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Recipient</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:name="confiform-field-definition">
        <ac:parameter ac:name="type">text</ac:parameter>
        <ac:parameter ac:name="fieldName">title</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Title</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:name="confiform-field-definition">
        <ac:parameter ac:name="type">textarea</ac:parameter>
        <ac:parameter ac:name="fieldName">messageBody</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Message body</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:name="confiform-field-definition">
        <ac:parameter ac:name="type">file</ac:parameter>
        <ac:parameter ac:name="fieldName">myattachment</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Attachment</ac:parameter>
      </ac:structured-macro>
      <ac:structured-macro ac:name="confiform-entry-register">
        <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
        <ac:parameter ac:name="embedded">true</ac:parameter>
        <ac:rich-text-body>
          <p>&nbsp;</p>
        </ac:rich-text-body>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:name="confiform-ifttt">
      <ac:parameter ac:name="title">[entry.title]</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="action">Send Email</ac:parameter>
      <ac:parameter ac:name="who">[entry.recipient]</ac:parameter>
      <ac:rich-text-body>
        <p>[entry.messageBody]</p>
        <p>
          <ac:structured-macro ac:name="confiform-field">
            <ac:parameter ac:name="fieldName">myattachment</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>