Page tree

Versions Compared

Key

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



 

 

Info

In this tutorial we will create an attachment of ICS format (calendar invitation) which we will then upload to original ConfiForms entry and then will use it (include as attachment) in the email sent to user

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

 


Let's start with describing the building blocks. We will have a form with 5 fields

...

"File" field is hidden with ConfiForms Field Definition Rules macro like this:

 


(so it is hidden for new records (the ones which doe snot have and "id" assigned, therefore the filter is: "id:", and the action is to hide the field: "fileAttach"))

 


Info

EventFileName field is not necessary, and is here only for the demo purpose, to show how you can use it with naming your files in IFTTT

See below...

 


And we have 2 IFTTT macros, which execute on record "created" event

 


We will look in more details at 1st IFTTT macro which creates the file and uploads it as attachment to the record

...

And references the form and page where this form is located/configured

 


You are free to change the format of the file generated, in this example we were generating an ICS file based on the data we have, but you can generate any file you want based on your own template

For our ICS file the template is as follows:

 


Code Block
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:[user.email]
DTSTAMP:[entry.dt.startDate.formatDate(yyyyMMdd'T'HHmmssZ)]
ORGANIZER;CN=[user.fullName]:MAILTO:[user.email]
DTSTART:[entry.dt.startDate.formatDate(yyyyMMdd'T'HHmmssZ)]
DTEND:[entry.dt.endDate.formatDate(yyyyMMdd'T'HHmmssZ)]
SUMMARY:[entry.eventTitle]
DESCRIPTION: [entry.eventDescription]
END:VEVENT
END:VCALENDAR

 

 



Complete solution could be found here

Expand
Code Block
<ac:structured-macro ac:macro-id="5bd7acb5-b878-4b87-8601-92d16c67e337" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f</ac:parameter>
  <ac:rich-text-body>
    <p>
      <br/>
      <ac:structured-macro ac:macro-id="bab26a4d-56eb-4c85-9972-4af30c66c75a" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">fileAttach</ac:parameter>
        <ac:parameter ac:name="fieldLabel">fileAttach</ac:parameter>
        <ac:parameter ac:name="type">file</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="8f0235cc-228d-4d07-8678-bc6fd2c2fcb1" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">eventFileName</ac:parameter>
        <ac:parameter ac:name="fieldLabel">eventFileName</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="75b14f19-8437-4577-b75d-59a0c0a49823" ac:name="confiform-field-definition" ac:schema-version="1">
      <ac:parameter ac:name="fieldName">eventTitle</ac:parameter>
      <ac:parameter ac:name="fieldLabel">Event Title</ac:parameter>
      <ac:parameter ac:name="type">text</ac:parameter>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="05b0b595-9387-4ded-91ba-d43f796f7a8d" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">dt</ac:parameter>
        <ac:parameter ac:name="fieldLabel">When</ac:parameter>
        <ac:parameter ac:name="type">datetimeinterval</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="2d5c0d0b-ec16-4603-9182-b92b5c50645d" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">eventDescription</ac:parameter>
        <ac:parameter ac:name="fieldLabel">eventDescription</ac:parameter>
        <ac:parameter ac:name="type">textarea</ac:parameter>
      </ac:structured-macro>
      <ac:structured-macro ac:macro-id="abdba410-99ec-43a7-91e6-e324f22d3dc8" ac:name="confiform-entry-register" ac:schema-version="1">
        <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
        <ac:rich-text-body>
          <p> </p>
        </ac:rich-text-body>
      </ac:structured-macro>
      <ac:structured-macro ac:macro-id="15a29681-2b71-47db-8072-e3ee5753c678" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">id:</ac:parameter>
        <ac:parameter ac:name="fieldName">fileAttach</ac:parameter>
        <ac:parameter ac:name="action">Hide field</ac:parameter>
      </ac:structured-macro>
    </p>
    <ac:structured-macro ac:macro-id="e8bf9a9c-42ff-4e33-a7be-ffd71c935468" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Create Attachment</ac:parameter>
      <ac:parameter ac:name="extras">[entry.eventFileName]_[entry.created].ics</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">fileAttach</ac:parameter>
      <ac:parameter ac:name="who">f:5341819</ac:parameter>
      <ac:rich-text-body>
        <ac:structured-macro ac:macro-id="bb96433d-e837-45ad-9b1a-77e396396d07" ac:name="noformat" ac:schema-version="1">
          <ac:plain-text-body><![CDATA[BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:[user.email]
DTSTAMP:[entry.dt.startDate.formatDate(yyyyMMdd'T'HHmmssZ)]
ORGANIZER;CN=[user.fullName]:MAILTO:[user.email]
DTSTART:[entry.dt.startDate.formatDate(yyyyMMdd'T'HHmmssZ)]
DTEND:[entry.dt.endDate.formatDate(yyyyMMdd'T'HHmmssZ)]
SUMMARY:[entry.eventTitle]
DESCRIPTION: [entry.eventDescription]
END:VEVENT
END:VCALENDAR]]></ac:plain-text-body>
        </ac:structured-macro>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="45478de4-53cd-4326-a4c3-827d88176c45" ac:name="confiform-ifttt" ac:schema-version="1">
      <ac:parameter ac:name="action">Send Email</ac:parameter>
      <ac:parameter ac:name="event">onCreated</ac:parameter>
      <ac:parameter ac:name="title">testing ics</ac:parameter>
      <ac:parameter ac:name="who">sasha@vertuna.com</ac:parameter>
      <ac:rich-text-body>
        <p>Hello, an ics attached</p>
        <p>
          <ac:structured-macro ac:macro-id="2da66e36-78e5-402e-adb9-6e9b76901ab5" ac:name="confiform-field" ac:schema-version="1">
            <ac:parameter ac:name="fieldName">fileAttach</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p> </p>
    <p> </p>
    <p> </p>
  </ac:rich-text-body>
</ac:structured-macro>